@vonage/vivid 3.0.0-next.11 → 3.0.0-next.110

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 (209) hide show
  1. package/README.md +165 -4
  2. package/accordion/index.js +5 -14
  3. package/accordion-item/index.js +34 -41
  4. package/action-group/index.js +37 -0
  5. package/avatar/index.js +61 -0
  6. package/badge/index.js +23 -35
  7. package/banner/index.js +20 -115
  8. package/breadcrumb/index.js +22 -19
  9. package/breadcrumb-item/index.js +28 -25
  10. package/button/index.js +29 -690
  11. package/calendar/index.js +70 -69
  12. package/calendar-event/index.js +109 -0
  13. package/card/index.js +112 -0
  14. package/checkbox/index.js +178 -0
  15. package/custom-elements.json +3941 -0
  16. package/dialog/index.js +214 -0
  17. package/divider/index.js +27 -0
  18. package/elevation/index.js +10 -16
  19. package/fab/index.js +98 -0
  20. package/focus/index.js +18 -3
  21. package/header/index.js +63 -0
  22. package/icon/index.js +9 -12
  23. package/index.js +68 -22
  24. package/layout/index.js +6 -16
  25. package/lib/accordion-item/accordion-item.d.ts +2 -2
  26. package/lib/accordion-item/index.d.ts +0 -1
  27. package/lib/action-group/action-group.d.ts +10 -0
  28. package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
  29. package/lib/{sidenav-item → action-group}/index.d.ts +1 -2
  30. package/lib/avatar/avatar.d.ts +15 -0
  31. package/lib/avatar/avatar.template.d.ts +4 -0
  32. package/lib/avatar/index.d.ts +2 -0
  33. package/lib/badge/badge.d.ts +3 -5
  34. package/lib/badge/index.d.ts +1 -2
  35. package/lib/banner/banner.d.ts +1 -1
  36. package/lib/banner/banner.template.d.ts +0 -2
  37. package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
  38. package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  39. package/lib/breadcrumb-item/index.d.ts +0 -1
  40. package/lib/button/button.d.ts +4 -3
  41. package/lib/button/index.d.ts +1 -21
  42. package/lib/calendar/calendar.d.ts +3 -1
  43. package/lib/calendar/index.d.ts +0 -1
  44. package/lib/calendar-event/calendar-event.d.ts +14 -0
  45. package/lib/calendar-event/calendar-event.template.d.ts +4 -0
  46. package/lib/calendar-event/index.d.ts +2 -0
  47. package/lib/card/card.d.ts +10 -0
  48. package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
  49. package/lib/{text → card}/index.d.ts +1 -1
  50. package/lib/checkbox/checkbox.d.ts +5 -0
  51. package/lib/checkbox/checkbox.template.d.ts +4 -0
  52. package/lib/checkbox/index.d.ts +2 -0
  53. package/lib/components.d.ts +32 -10
  54. package/lib/dialog/dialog.d.ts +20 -0
  55. package/lib/dialog/dialog.template.d.ts +4 -0
  56. package/lib/dialog/index.d.ts +2 -0
  57. package/lib/divider/divider.d.ts +3 -0
  58. package/lib/divider/divider.template.d.ts +4 -0
  59. package/lib/divider/index.d.ts +2 -0
  60. package/lib/elevation/elevation.d.ts +1 -0
  61. package/lib/elevation/index.d.ts +1 -1
  62. package/lib/enums.d.ts +19 -6
  63. package/lib/fab/fab.d.ts +13 -0
  64. package/lib/fab/fab.template.d.ts +4 -0
  65. package/lib/fab/index.d.ts +2 -0
  66. package/lib/focus/index.d.ts +1 -1
  67. package/lib/header/header.d.ts +5 -0
  68. package/lib/header/header.template.d.ts +4 -0
  69. package/lib/header/index.d.ts +2 -0
  70. package/lib/icon/icon.d.ts +5 -6
  71. package/lib/layout/index.d.ts +1 -1
  72. package/lib/layout/layout.d.ts +4 -4
  73. package/lib/listbox/index.d.ts +1 -0
  74. package/lib/listbox/listbox.d.ts +9 -0
  75. package/lib/listbox/listbox.template.d.ts +4 -0
  76. package/lib/menu/index.d.ts +10 -0
  77. package/lib/menu/menu.d.ts +10 -0
  78. package/lib/menu/menu.template.d.ts +3 -0
  79. package/lib/menu-item/index.d.ts +2 -0
  80. package/lib/menu-item/menu-item.d.ts +7 -0
  81. package/lib/menu-item/menu-item.template.d.ts +5 -0
  82. package/lib/nav/index.d.ts +2 -0
  83. package/lib/nav/nav.d.ts +3 -0
  84. package/lib/nav/nav.template.d.ts +4 -0
  85. package/lib/nav-disclosure/index.d.ts +2 -0
  86. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
  87. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
  88. package/lib/nav-item/index.d.ts +2 -0
  89. package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
  90. package/lib/nav-item/nav-item.template.d.ts +4 -0
  91. package/lib/note/index.d.ts +2 -0
  92. package/lib/note/note.d.ts +10 -0
  93. package/lib/note/note.template.d.ts +4 -0
  94. package/lib/number-field/index.d.ts +2 -0
  95. package/lib/number-field/number-field.d.ts +14 -0
  96. package/lib/number-field/number-field.template.d.ts +4 -0
  97. package/lib/option/index.d.ts +2 -0
  98. package/lib/option/option.d.ts +9 -0
  99. package/lib/option/option.template.d.ts +4 -0
  100. package/lib/popup/index.d.ts +1 -3
  101. package/lib/popup/popup.d.ts +3 -2
  102. package/lib/progress/progress.d.ts +1 -1
  103. package/lib/progress-ring/progress-ring.d.ts +2 -1
  104. package/lib/radio/index.d.ts +2 -0
  105. package/lib/radio/radio.d.ts +4 -0
  106. package/lib/radio/radio.template.d.ts +4 -0
  107. package/lib/radio-group/index.d.ts +10 -0
  108. package/lib/radio-group/radio-group.d.ts +4 -0
  109. package/lib/radio-group/radio-group.template.d.ts +4 -0
  110. package/lib/side-drawer/index.d.ts +1 -1
  111. package/lib/side-drawer/side-drawer.d.ts +3 -2
  112. package/lib/slider/index.d.ts +2 -0
  113. package/lib/slider/slider.d.ts +4 -0
  114. package/lib/slider/slider.template.d.ts +4 -0
  115. package/lib/switch/index.d.ts +2 -0
  116. package/lib/switch/switch.d.ts +7 -0
  117. package/lib/switch/switch.template.d.ts +4 -0
  118. package/lib/text-anchor/text-anchor.d.ts +1 -1
  119. package/lib/text-area/index.d.ts +2 -0
  120. package/lib/text-area/text-area.d.ts +9 -0
  121. package/lib/text-area/text-area.template.d.ts +4 -0
  122. package/lib/text-field/index.d.ts +2 -0
  123. package/lib/text-field/text-field.d.ts +14 -0
  124. package/lib/text-field/text-field.template.d.ts +4 -0
  125. package/lib/tooltip/index.d.ts +0 -1
  126. package/lib/tooltip/tooltip.d.ts +7 -7
  127. package/listbox/index.js +1086 -0
  128. package/menu/index.js +357 -0
  129. package/menu-item/index.js +90 -0
  130. package/nav/index.js +17 -0
  131. package/nav-disclosure/index.js +80 -0
  132. package/nav-item/index.js +44 -0
  133. package/note/index.js +59 -0
  134. package/number-field/index.js +460 -0
  135. package/option/index.js +75 -0
  136. package/package.json +62 -10
  137. package/popup/index.js +35 -2036
  138. package/progress/index.js +33 -38
  139. package/progress-ring/index.js +13 -13
  140. package/radio/index.js +52 -0
  141. package/radio-group/index.js +435 -0
  142. package/shared/affix.js +2 -8
  143. package/shared/anchor.js +11 -3
  144. package/shared/apply-mixins.js +5 -4
  145. package/shared/aria-global.js +2 -86
  146. package/shared/aria.js +9 -0
  147. package/shared/base-progress.js +6 -1
  148. package/shared/breadcrumb-item.js +2 -2
  149. package/shared/button.js +23 -0
  150. package/shared/button2.js +200 -0
  151. package/shared/calendar-event.js +19 -0
  152. package/shared/design-system/index.d.ts +1 -1
  153. package/shared/dialog-polyfill.esm.js +858 -0
  154. package/shared/direction.js +20 -0
  155. package/shared/divider.js +55 -0
  156. package/shared/dom.js +8 -0
  157. package/shared/elevation.js +10 -0
  158. package/shared/enums.js +70 -0
  159. package/shared/es.object.assign.js +2 -59
  160. package/shared/es.promise.resolve.js +944 -0
  161. package/shared/es.regexp.to-string.js +58 -0
  162. package/shared/focus.js +11 -0
  163. package/shared/focus2.js +5 -0
  164. package/shared/form-associated.js +466 -0
  165. package/shared/form-elements.js +343 -0
  166. package/shared/icon.js +32 -1153
  167. package/shared/index.js +3780 -83
  168. package/shared/index2.js +7 -19
  169. package/shared/key-codes.js +97 -0
  170. package/shared/listbox-option.js +201 -0
  171. package/shared/menu-item.js +277 -0
  172. package/shared/numbers.js +25 -0
  173. package/shared/patterns/focus.d.ts +3 -0
  174. package/shared/patterns/form-elements/form-elements.d.ts +31 -0
  175. package/shared/patterns/form-elements/index.d.ts +1 -0
  176. package/shared/patterns/index.d.ts +2 -0
  177. package/shared/popup.js +1484 -0
  178. package/shared/radio.js +127 -0
  179. package/shared/ref.js +41 -0
  180. package/shared/slotted.js +1 -1
  181. package/shared/start-end.js +50 -0
  182. package/shared/string-trim.js +39 -0
  183. package/shared/text-anchor.js +2 -13
  184. package/shared/text-anchor.template.js +6 -5
  185. package/shared/utils/index.d.ts +1 -0
  186. package/side-drawer/index.js +38 -34
  187. package/slider/index.js +596 -0
  188. package/styles/core/all.css +86 -0
  189. package/styles/core/theme.css +11 -0
  190. package/styles/core/typography.css +80 -0
  191. package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
  192. package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
  193. package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
  194. package/styles/fonts/spezia.css +9 -12
  195. package/styles/tokens/theme-dark.css +230 -0
  196. package/styles/tokens/theme-light.css +230 -0
  197. package/switch/index.js +153 -0
  198. package/text-anchor/index.js +8 -3
  199. package/text-area/index.js +288 -0
  200. package/text-field/index.js +129 -0
  201. package/tooltip/index.js +59 -43
  202. package/vivid.api.json +2979 -0
  203. package/lib/text/text.d.ts +0 -10
  204. package/shared/style-inject.es.js +0 -28
  205. package/shared/web.dom-collections.iterator.js +0 -1479
  206. package/sidenav-item/index.js +0 -38
  207. package/styles/themes/dark.css +0 -205
  208. package/styles/themes/light.css +0 -205
  209. package/text/index.js +0 -45
package/shared/index2.js CHANGED
@@ -1,21 +1,9 @@
1
- import { F as FoundationElement, h as html, d as designSystem } from './index.js';
2
- import { s as styleInject } from './style-inject.es.js';
1
+ import './es.promise.resolve.js';
2
+ import './index.js';
3
3
 
4
- class Focus extends FoundationElement {}
4
+ const loadComponentsModules = (components, prefix) => {
5
+ components.forEach(component => import(`../${component}/index.js?prefix=${prefix}`));
6
+ return Promise.all(components.map(component => customElements.whenDefined(`${prefix}-${component}`)));
7
+ };
5
8
 
6
- var css_248z = ":host {\n display: contents;\n border-radius: inherit;\n}\n\n.control {\n position: absolute;\n box-sizing: border-box;\n border-radius: inherit;\n box-shadow: inset 0 0 0 2px var(--focus-stroke-color, var(--vvd-color-on-canvas)), inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);\n inset: 0;\n}";
7
- styleInject(css_248z);
8
-
9
- let _ = t => t,
10
- _t;
11
- const focusTemplate = () => html(_t || (_t = _`
12
- <span class="control"></span>`));
13
-
14
- const VIVIDFocus = Focus.compose({
15
- baseName: 'focus',
16
- template: focusTemplate,
17
- styles: css_248z
18
- });
19
- designSystem.register(VIVIDFocus());
20
-
21
- export { Focus as F, VIVIDFocus as V };
9
+ export { loadComponentsModules as l };
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Key Code values
3
+ * @deprecated - KeyCodes are deprecated, use individual string key exports
4
+ */
5
+ var KeyCodes;
6
+ (function (KeyCodes) {
7
+ KeyCodes[KeyCodes["alt"] = 18] = "alt";
8
+ KeyCodes[KeyCodes["arrowDown"] = 40] = "arrowDown";
9
+ KeyCodes[KeyCodes["arrowLeft"] = 37] = "arrowLeft";
10
+ KeyCodes[KeyCodes["arrowRight"] = 39] = "arrowRight";
11
+ KeyCodes[KeyCodes["arrowUp"] = 38] = "arrowUp";
12
+ KeyCodes[KeyCodes["back"] = 8] = "back";
13
+ KeyCodes[KeyCodes["backSlash"] = 220] = "backSlash";
14
+ KeyCodes[KeyCodes["break"] = 19] = "break";
15
+ KeyCodes[KeyCodes["capsLock"] = 20] = "capsLock";
16
+ KeyCodes[KeyCodes["closeBracket"] = 221] = "closeBracket";
17
+ KeyCodes[KeyCodes["colon"] = 186] = "colon";
18
+ KeyCodes[KeyCodes["colon2"] = 59] = "colon2";
19
+ KeyCodes[KeyCodes["comma"] = 188] = "comma";
20
+ KeyCodes[KeyCodes["ctrl"] = 17] = "ctrl";
21
+ KeyCodes[KeyCodes["delete"] = 46] = "delete";
22
+ KeyCodes[KeyCodes["end"] = 35] = "end";
23
+ KeyCodes[KeyCodes["enter"] = 13] = "enter";
24
+ KeyCodes[KeyCodes["equals"] = 187] = "equals";
25
+ KeyCodes[KeyCodes["equals2"] = 61] = "equals2";
26
+ KeyCodes[KeyCodes["equals3"] = 107] = "equals3";
27
+ KeyCodes[KeyCodes["escape"] = 27] = "escape";
28
+ KeyCodes[KeyCodes["forwardSlash"] = 191] = "forwardSlash";
29
+ KeyCodes[KeyCodes["function1"] = 112] = "function1";
30
+ KeyCodes[KeyCodes["function10"] = 121] = "function10";
31
+ KeyCodes[KeyCodes["function11"] = 122] = "function11";
32
+ KeyCodes[KeyCodes["function12"] = 123] = "function12";
33
+ KeyCodes[KeyCodes["function2"] = 113] = "function2";
34
+ KeyCodes[KeyCodes["function3"] = 114] = "function3";
35
+ KeyCodes[KeyCodes["function4"] = 115] = "function4";
36
+ KeyCodes[KeyCodes["function5"] = 116] = "function5";
37
+ KeyCodes[KeyCodes["function6"] = 117] = "function6";
38
+ KeyCodes[KeyCodes["function7"] = 118] = "function7";
39
+ KeyCodes[KeyCodes["function8"] = 119] = "function8";
40
+ KeyCodes[KeyCodes["function9"] = 120] = "function9";
41
+ KeyCodes[KeyCodes["home"] = 36] = "home";
42
+ KeyCodes[KeyCodes["insert"] = 45] = "insert";
43
+ KeyCodes[KeyCodes["menu"] = 93] = "menu";
44
+ KeyCodes[KeyCodes["minus"] = 189] = "minus";
45
+ KeyCodes[KeyCodes["minus2"] = 109] = "minus2";
46
+ KeyCodes[KeyCodes["numLock"] = 144] = "numLock";
47
+ KeyCodes[KeyCodes["numPad0"] = 96] = "numPad0";
48
+ KeyCodes[KeyCodes["numPad1"] = 97] = "numPad1";
49
+ KeyCodes[KeyCodes["numPad2"] = 98] = "numPad2";
50
+ KeyCodes[KeyCodes["numPad3"] = 99] = "numPad3";
51
+ KeyCodes[KeyCodes["numPad4"] = 100] = "numPad4";
52
+ KeyCodes[KeyCodes["numPad5"] = 101] = "numPad5";
53
+ KeyCodes[KeyCodes["numPad6"] = 102] = "numPad6";
54
+ KeyCodes[KeyCodes["numPad7"] = 103] = "numPad7";
55
+ KeyCodes[KeyCodes["numPad8"] = 104] = "numPad8";
56
+ KeyCodes[KeyCodes["numPad9"] = 105] = "numPad9";
57
+ KeyCodes[KeyCodes["numPadDivide"] = 111] = "numPadDivide";
58
+ KeyCodes[KeyCodes["numPadDot"] = 110] = "numPadDot";
59
+ KeyCodes[KeyCodes["numPadMinus"] = 109] = "numPadMinus";
60
+ KeyCodes[KeyCodes["numPadMultiply"] = 106] = "numPadMultiply";
61
+ KeyCodes[KeyCodes["numPadPlus"] = 107] = "numPadPlus";
62
+ KeyCodes[KeyCodes["openBracket"] = 219] = "openBracket";
63
+ KeyCodes[KeyCodes["pageDown"] = 34] = "pageDown";
64
+ KeyCodes[KeyCodes["pageUp"] = 33] = "pageUp";
65
+ KeyCodes[KeyCodes["period"] = 190] = "period";
66
+ KeyCodes[KeyCodes["print"] = 44] = "print";
67
+ KeyCodes[KeyCodes["quote"] = 222] = "quote";
68
+ KeyCodes[KeyCodes["scrollLock"] = 145] = "scrollLock";
69
+ KeyCodes[KeyCodes["shift"] = 16] = "shift";
70
+ KeyCodes[KeyCodes["space"] = 32] = "space";
71
+ KeyCodes[KeyCodes["tab"] = 9] = "tab";
72
+ KeyCodes[KeyCodes["tilde"] = 192] = "tilde";
73
+ KeyCodes[KeyCodes["windowsLeft"] = 91] = "windowsLeft";
74
+ KeyCodes[KeyCodes["windowsOpera"] = 219] = "windowsOpera";
75
+ KeyCodes[KeyCodes["windowsRight"] = 92] = "windowsRight";
76
+ })(KeyCodes || (KeyCodes = {}));
77
+ /**
78
+ * String values for use with KeyboardEvent.key
79
+ */
80
+ const keyArrowDown = "ArrowDown";
81
+ const keyArrowLeft = "ArrowLeft";
82
+ const keyArrowRight = "ArrowRight";
83
+ const keyArrowUp = "ArrowUp";
84
+ const keyEnter = "Enter";
85
+ const keyEscape = "Escape";
86
+ const keyHome = "Home";
87
+ const keyEnd = "End";
88
+ const keySpace = " ";
89
+ const keyTab = "Tab";
90
+ const ArrowKeys = {
91
+ ArrowDown: keyArrowDown,
92
+ ArrowLeft: keyArrowLeft,
93
+ ArrowRight: keyArrowRight,
94
+ ArrowUp: keyArrowUp,
95
+ };
96
+
97
+ export { ArrowKeys as A, keySpace as a, keyEscape as b, keyTab as c, keyEnd as d, keyArrowUp as e, keyArrowDown as f, keyHome as g, keyArrowLeft as h, keyArrowRight as i, keyEnter as k };
@@ -0,0 +1,201 @@
1
+ import { F as FoundationElement, Z as Observable, _ as __decorate, V as observable, a as attr } from './index.js';
2
+ import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
3
+ import { S as StartEnd } from './start-end.js';
4
+ import { a as applyMixins } from './apply-mixins.js';
5
+ import { i as isHTMLElement } from './dom.js';
6
+
7
+ /**
8
+ * Determines if the element is a {@link (ListboxOption:class)}
9
+ *
10
+ * @param element - the element to test.
11
+ * @public
12
+ */
13
+ function isListboxOption(el) {
14
+ return (isHTMLElement(el) &&
15
+ (el.getAttribute("role") === "option" ||
16
+ el instanceof HTMLOptionElement));
17
+ }
18
+ /**
19
+ * An Option Custom HTML Element.
20
+ * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
21
+ *
22
+ * @slot start - Content which can be provided before the listbox option content
23
+ * @slot end - Content which can be provided after the listbox option content
24
+ * @slot - The default slot for listbox option content
25
+ * @csspart content - Wraps the listbox option content
26
+ *
27
+ * @public
28
+ */
29
+ class ListboxOption extends FoundationElement {
30
+ constructor(text, value, defaultSelected, selected) {
31
+ super();
32
+ /**
33
+ * The defaultSelected state of the option.
34
+ * @public
35
+ */
36
+ this.defaultSelected = false;
37
+ /**
38
+ * Tracks whether the "selected" property has been changed.
39
+ * @internal
40
+ */
41
+ this.dirtySelected = false;
42
+ /**
43
+ * The checked state of the control.
44
+ *
45
+ * @public
46
+ */
47
+ this.selected = this.defaultSelected;
48
+ /**
49
+ * Track whether the value has been changed from the initial value
50
+ */
51
+ this.dirtyValue = false;
52
+ if (text) {
53
+ this.textContent = text;
54
+ }
55
+ if (value) {
56
+ this.initialValue = value;
57
+ }
58
+ if (defaultSelected) {
59
+ this.defaultSelected = defaultSelected;
60
+ }
61
+ if (selected) {
62
+ this.selected = selected;
63
+ }
64
+ this.proxy = new Option(`${this.textContent}`, this.initialValue, this.defaultSelected, this.selected);
65
+ this.proxy.disabled = this.disabled;
66
+ }
67
+ /**
68
+ * Updates the ariaChecked property when the checked property changes.
69
+ *
70
+ * @param prev - the previous checked value
71
+ * @param next - the current checked value
72
+ *
73
+ * @public
74
+ */
75
+ checkedChanged(prev, next) {
76
+ if (typeof next === "boolean") {
77
+ this.ariaChecked = next ? "true" : "false";
78
+ return;
79
+ }
80
+ this.ariaChecked = null;
81
+ }
82
+ /**
83
+ * Updates the proxy's text content when the default slot changes.
84
+ * @param prev - the previous content value
85
+ * @param next - the current content value
86
+ *
87
+ * @internal
88
+ */
89
+ contentChanged(prev, next) {
90
+ if (this.proxy instanceof HTMLOptionElement) {
91
+ this.proxy.textContent = this.textContent;
92
+ }
93
+ this.$emit("contentchange", null, { bubbles: true });
94
+ }
95
+ defaultSelectedChanged() {
96
+ if (!this.dirtySelected) {
97
+ this.selected = this.defaultSelected;
98
+ if (this.proxy instanceof HTMLOptionElement) {
99
+ this.proxy.selected = this.defaultSelected;
100
+ }
101
+ }
102
+ }
103
+ disabledChanged(prev, next) {
104
+ this.ariaDisabled = this.disabled ? "true" : "false";
105
+ if (this.proxy instanceof HTMLOptionElement) {
106
+ this.proxy.disabled = this.disabled;
107
+ }
108
+ }
109
+ selectedAttributeChanged() {
110
+ this.defaultSelected = this.selectedAttribute;
111
+ if (this.proxy instanceof HTMLOptionElement) {
112
+ this.proxy.defaultSelected = this.defaultSelected;
113
+ }
114
+ }
115
+ selectedChanged() {
116
+ this.ariaSelected = this.selected ? "true" : "false";
117
+ if (!this.dirtySelected) {
118
+ this.dirtySelected = true;
119
+ }
120
+ if (this.proxy instanceof HTMLOptionElement) {
121
+ this.proxy.selected = this.selected;
122
+ }
123
+ }
124
+ initialValueChanged(previous, next) {
125
+ // If the value is clean and the component is connected to the DOM
126
+ // then set value equal to the attribute value.
127
+ if (!this.dirtyValue) {
128
+ this.value = this.initialValue;
129
+ this.dirtyValue = false;
130
+ }
131
+ }
132
+ get label() {
133
+ var _a;
134
+ return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
135
+ }
136
+ get text() {
137
+ var _a, _b;
138
+ return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
139
+ }
140
+ set value(next) {
141
+ const newValue = `${next !== null && next !== void 0 ? next : ""}`;
142
+ this._value = newValue;
143
+ this.dirtyValue = true;
144
+ if (this.proxy instanceof HTMLOptionElement) {
145
+ this.proxy.value = newValue;
146
+ }
147
+ Observable.notify(this, "value");
148
+ }
149
+ get value() {
150
+ var _a;
151
+ Observable.track(this, "value");
152
+ return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
153
+ }
154
+ get form() {
155
+ return this.proxy ? this.proxy.form : null;
156
+ }
157
+ }
158
+ __decorate([
159
+ observable
160
+ ], ListboxOption.prototype, "checked", void 0);
161
+ __decorate([
162
+ observable
163
+ ], ListboxOption.prototype, "content", void 0);
164
+ __decorate([
165
+ observable
166
+ ], ListboxOption.prototype, "defaultSelected", void 0);
167
+ __decorate([
168
+ attr({ mode: "boolean" })
169
+ ], ListboxOption.prototype, "disabled", void 0);
170
+ __decorate([
171
+ attr({ attribute: "selected", mode: "boolean" })
172
+ ], ListboxOption.prototype, "selectedAttribute", void 0);
173
+ __decorate([
174
+ observable
175
+ ], ListboxOption.prototype, "selected", void 0);
176
+ __decorate([
177
+ attr({ attribute: "value", mode: "fromView" })
178
+ ], ListboxOption.prototype, "initialValue", void 0);
179
+ /**
180
+ * States and properties relating to the ARIA `option` role.
181
+ *
182
+ * @public
183
+ */
184
+ class DelegatesARIAListboxOption {
185
+ }
186
+ __decorate([
187
+ observable
188
+ ], DelegatesARIAListboxOption.prototype, "ariaChecked", void 0);
189
+ __decorate([
190
+ observable
191
+ ], DelegatesARIAListboxOption.prototype, "ariaPosInSet", void 0);
192
+ __decorate([
193
+ observable
194
+ ], DelegatesARIAListboxOption.prototype, "ariaSelected", void 0);
195
+ __decorate([
196
+ observable
197
+ ], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
198
+ applyMixins(DelegatesARIAListboxOption, ARIAGlobalStatesAndProperties);
199
+ applyMixins(ListboxOption, StartEnd, DelegatesARIAListboxOption);
200
+
201
+ export { ListboxOption as L, isListboxOption as i };
@@ -0,0 +1,277 @@
1
+ import { F as FoundationElement, a2 as DOM, _ as __decorate, a as attr, V as observable } from './index.js';
2
+ import { S as StartEnd } from './start-end.js';
3
+ import { D as Direction, g as getDirection } from './direction.js';
4
+ import { a as applyMixins } from './apply-mixins.js';
5
+ import { h as keyArrowLeft, i as keyArrowRight, a as keySpace, k as keyEnter } from './key-codes.js';
6
+
7
+ /**
8
+ * Menu items roles.
9
+ * @public
10
+ */
11
+ const MenuItemRole = {
12
+ /**
13
+ * The menu item has a "menuitem" role
14
+ */
15
+ menuitem: "menuitem",
16
+ /**
17
+ * The menu item has a "menuitemcheckbox" role
18
+ */
19
+ menuitemcheckbox: "menuitemcheckbox",
20
+ /**
21
+ * The menu item has a "menuitemradio" role
22
+ */
23
+ menuitemradio: "menuitemradio",
24
+ };
25
+ /**
26
+ * @internal
27
+ */
28
+ const roleForMenuItem = {
29
+ [MenuItemRole.menuitem]: "menuitem",
30
+ [MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
31
+ [MenuItemRole.menuitemradio]: "menuitemradio",
32
+ };
33
+
34
+ /**
35
+ * A Switch Custom HTML Element.
36
+ * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
37
+ *
38
+ * @slot checked-indicator - The checked indicator
39
+ * @slot radio-indicator - The radio indicator
40
+ * @slot start - Content which can be provided before the menu item content
41
+ * @slot end - Content which can be provided after the menu item content
42
+ * @slot - The default slot for menu item content
43
+ * @slot expand-collapse-indicator - The expand/collapse indicator
44
+ * @slot submenu - Used to nest menu's within menu items
45
+ * @csspart input-container - The element representing the visual checked or radio indicator
46
+ * @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
47
+ * @csspart radio - The element wrapping the `menuitemradio` indicator
48
+ * @csspart content - The element wrapping the menu item content
49
+ * @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
50
+ * @csspart expand-collapse - The expand/collapse element
51
+ * @csspart submenu-region - The container for the submenu, used for positioning
52
+ * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
53
+ * @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
54
+ *
55
+ * @public
56
+ */
57
+ class MenuItem extends FoundationElement {
58
+ constructor() {
59
+ super(...arguments);
60
+ /**
61
+ * The role of the element.
62
+ *
63
+ * @public
64
+ * @remarks
65
+ * HTML Attribute: role
66
+ */
67
+ this.role = MenuItemRole.menuitem;
68
+ /**
69
+ * @internal
70
+ */
71
+ this.hasSubmenu = false;
72
+ /**
73
+ * Track current direction to pass to the anchored region
74
+ *
75
+ * @internal
76
+ */
77
+ this.currentDirection = Direction.ltr;
78
+ this.focusSubmenuOnLoad = false;
79
+ /**
80
+ * @internal
81
+ */
82
+ this.handleMenuItemKeyDown = (e) => {
83
+ if (e.defaultPrevented) {
84
+ return false;
85
+ }
86
+ switch (e.key) {
87
+ case keyEnter:
88
+ case keySpace:
89
+ this.invoke();
90
+ return false;
91
+ case keyArrowRight:
92
+ //open/focus on submenu
93
+ this.expandAndFocus();
94
+ return false;
95
+ case keyArrowLeft:
96
+ //close submenu
97
+ if (this.expanded) {
98
+ this.expanded = false;
99
+ this.focus();
100
+ return false;
101
+ }
102
+ }
103
+ return true;
104
+ };
105
+ /**
106
+ * @internal
107
+ */
108
+ this.handleMenuItemClick = (e) => {
109
+ if (e.defaultPrevented || this.disabled) {
110
+ return false;
111
+ }
112
+ this.invoke();
113
+ return false;
114
+ };
115
+ /**
116
+ * @internal
117
+ */
118
+ this.submenuLoaded = () => {
119
+ if (!this.focusSubmenuOnLoad) {
120
+ return;
121
+ }
122
+ this.focusSubmenuOnLoad = false;
123
+ if (this.hasSubmenu) {
124
+ this.submenu.focus();
125
+ this.setAttribute("tabindex", "-1");
126
+ }
127
+ };
128
+ /**
129
+ * @internal
130
+ */
131
+ this.handleMouseOver = (e) => {
132
+ if (this.disabled || !this.hasSubmenu || this.expanded) {
133
+ return false;
134
+ }
135
+ this.expanded = true;
136
+ return false;
137
+ };
138
+ /**
139
+ * @internal
140
+ */
141
+ this.handleMouseOut = (e) => {
142
+ if (!this.expanded || this.contains(document.activeElement)) {
143
+ return false;
144
+ }
145
+ this.expanded = false;
146
+ return false;
147
+ };
148
+ /**
149
+ * @internal
150
+ */
151
+ this.expandAndFocus = () => {
152
+ if (!this.hasSubmenu) {
153
+ return;
154
+ }
155
+ this.focusSubmenuOnLoad = true;
156
+ this.expanded = true;
157
+ };
158
+ /**
159
+ * @internal
160
+ */
161
+ this.invoke = () => {
162
+ if (this.disabled) {
163
+ return;
164
+ }
165
+ switch (this.role) {
166
+ case MenuItemRole.menuitemcheckbox:
167
+ this.checked = !this.checked;
168
+ break;
169
+ case MenuItemRole.menuitem:
170
+ // update submenu
171
+ this.updateSubmenu();
172
+ if (this.hasSubmenu) {
173
+ this.expandAndFocus();
174
+ }
175
+ else {
176
+ this.$emit("change");
177
+ }
178
+ break;
179
+ case MenuItemRole.menuitemradio:
180
+ if (!this.checked) {
181
+ this.checked = true;
182
+ }
183
+ break;
184
+ }
185
+ };
186
+ /**
187
+ * Gets the submenu element if any
188
+ *
189
+ * @internal
190
+ */
191
+ this.updateSubmenu = () => {
192
+ this.submenu = this.domChildren().find((element) => {
193
+ return element.getAttribute("role") === "menu";
194
+ });
195
+ this.hasSubmenu = this.submenu === undefined ? false : true;
196
+ };
197
+ }
198
+ expandedChanged(oldValue) {
199
+ if (this.$fastController.isConnected) {
200
+ if (this.submenu === undefined) {
201
+ return;
202
+ }
203
+ if (this.expanded === false) {
204
+ this.submenu.collapseExpandedItem();
205
+ }
206
+ else {
207
+ this.currentDirection = getDirection(this);
208
+ }
209
+ this.$emit("expanded-change", this, { bubbles: false });
210
+ }
211
+ }
212
+ checkedChanged(oldValue, newValue) {
213
+ if (this.$fastController.isConnected) {
214
+ this.$emit("change");
215
+ }
216
+ }
217
+ /**
218
+ * @internal
219
+ */
220
+ connectedCallback() {
221
+ super.connectedCallback();
222
+ DOM.queueUpdate(() => {
223
+ this.updateSubmenu();
224
+ });
225
+ if (!this.startColumnCount) {
226
+ this.startColumnCount = 1;
227
+ }
228
+ this.observer = new MutationObserver(this.updateSubmenu);
229
+ }
230
+ /**
231
+ * @internal
232
+ */
233
+ disconnectedCallback() {
234
+ super.disconnectedCallback();
235
+ this.submenu = undefined;
236
+ if (this.observer !== undefined) {
237
+ this.observer.disconnect();
238
+ this.observer = undefined;
239
+ }
240
+ }
241
+ /**
242
+ * get an array of valid DOM children
243
+ */
244
+ domChildren() {
245
+ return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
246
+ }
247
+ }
248
+ __decorate([
249
+ attr({ mode: "boolean" })
250
+ ], MenuItem.prototype, "disabled", void 0);
251
+ __decorate([
252
+ attr({ mode: "boolean" })
253
+ ], MenuItem.prototype, "expanded", void 0);
254
+ __decorate([
255
+ observable
256
+ ], MenuItem.prototype, "startColumnCount", void 0);
257
+ __decorate([
258
+ attr
259
+ ], MenuItem.prototype, "role", void 0);
260
+ __decorate([
261
+ attr({ mode: "boolean" })
262
+ ], MenuItem.prototype, "checked", void 0);
263
+ __decorate([
264
+ observable
265
+ ], MenuItem.prototype, "submenuRegion", void 0);
266
+ __decorate([
267
+ observable
268
+ ], MenuItem.prototype, "hasSubmenu", void 0);
269
+ __decorate([
270
+ observable
271
+ ], MenuItem.prototype, "currentDirection", void 0);
272
+ __decorate([
273
+ observable
274
+ ], MenuItem.prototype, "submenu", void 0);
275
+ applyMixins(MenuItem, StartEnd);
276
+
277
+ export { MenuItem as M, MenuItemRole as a, roleForMenuItem as r };
@@ -0,0 +1,25 @@
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
+
25
+ export { inRange as i, limit as l };
@@ -0,0 +1,3 @@
1
+ import type { ViewTemplate } from '@microsoft/fast-element';
2
+ import type { ElementDefinitionContext } from '@microsoft/fast-foundation';
3
+ export declare const focusTemplateFactory: (context: ElementDefinitionContext) => ViewTemplate | null;
@@ -0,0 +1,31 @@
1
+ import type { ElementDefinitionContext } from '@microsoft/fast-foundation';
2
+ export interface FormElement {
3
+ charCount: boolean;
4
+ errorValidationMessage: boolean;
5
+ helperText: string;
6
+ successText: string;
7
+ label: string;
8
+ userValid: boolean;
9
+ dirtyValue: boolean;
10
+ }
11
+ export declare function formElements<T extends {
12
+ new (...args: any[]): Record<string, any>;
13
+ }>(constructor: T): {
14
+ new (...args: any[]): {
15
+ [x: string]: any;
16
+ label?: string | undefined;
17
+ helperText?: string | undefined;
18
+ successText?: string | undefined;
19
+ charCount: boolean;
20
+ userValid: boolean;
21
+ "__#7248@#blurred": boolean;
22
+ readonly errorValidationMessage: any;
23
+ connectedCallback(): void;
24
+ "__#7248@#handleInvalidEvent": () => void;
25
+ disconnectedCallback(): void;
26
+ validate: () => void;
27
+ };
28
+ } & T;
29
+ declare type FeedbackType = 'error' | 'helper' | 'success';
30
+ export declare function getFeedbackTemplate(messageType: FeedbackType, context: ElementDefinitionContext): import("@microsoft/fast-element").ViewTemplate<FormElement, any>;
31
+ export {};
@@ -0,0 +1 @@
1
+ export * from './form-elements';
@@ -1 +1,3 @@
1
1
  export * from './affix';
2
+ export * from './focus';
3
+ export * from './form-elements';