@vonage/vivid 3.0.0-test.0 → 3.0.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 (325) hide show
  1. package/README.md +176 -4
  2. package/accordion/index.js +22 -61
  3. package/accordion-item/index.js +16 -123
  4. package/action-group/index.js +5 -0
  5. package/avatar/index.js +11 -0
  6. package/badge/index.js +9 -60
  7. package/banner/index.js +20 -208
  8. package/breadcrumb/index.js +7 -96
  9. package/breadcrumb-item/index.js +15 -48
  10. package/button/index.js +19 -758
  11. package/calendar/index.js +5 -1519
  12. package/calendar-event/index.js +9 -0
  13. package/card/index.js +13 -0
  14. package/checkbox/index.js +16 -0
  15. package/combobox/index.js +35 -0
  16. package/dialog/index.js +24 -0
  17. package/divider/index.js +6 -0
  18. package/elevation/index.js +4 -30
  19. package/fab/index.js +22 -0
  20. package/focus/index.js +4 -2
  21. package/header/index.js +6 -0
  22. package/icon/index.js +8 -32
  23. package/index.js +76 -25
  24. package/layout/index.js +4 -52
  25. package/lib/accordion/accordion.d.ts +3 -7
  26. package/lib/accordion/accordion.template.d.ts +1 -2
  27. package/lib/accordion/definition.d.ts +1 -0
  28. package/lib/accordion/index.d.ts +1 -2
  29. package/lib/accordion-item/accordion-item.d.ts +4 -8
  30. package/lib/accordion-item/accordion-item.template.d.ts +4 -4
  31. package/lib/accordion-item/definition.d.ts +1 -0
  32. package/lib/accordion-item/index.d.ts +1 -3
  33. package/lib/action-group/action-group.d.ts +10 -0
  34. package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
  35. package/lib/action-group/definition.d.ts +1 -0
  36. package/lib/action-group/index.d.ts +1 -0
  37. package/lib/avatar/avatar.d.ts +15 -0
  38. package/lib/avatar/avatar.template.d.ts +4 -0
  39. package/lib/avatar/definition.d.ts +1 -0
  40. package/lib/avatar/index.d.ts +1 -0
  41. package/lib/badge/badge.d.ts +4 -6
  42. package/lib/badge/definition.d.ts +3 -0
  43. package/lib/badge/index.d.ts +1 -3
  44. package/lib/banner/banner.d.ts +1 -1
  45. package/lib/banner/banner.template.d.ts +0 -2
  46. package/lib/banner/definition.d.ts +1 -0
  47. package/lib/banner/index.d.ts +1 -2
  48. package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
  49. package/lib/breadcrumb/definition.d.ts +1 -0
  50. package/lib/breadcrumb/index.d.ts +1 -2
  51. package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  52. package/lib/breadcrumb-item/definition.d.ts +1 -0
  53. package/lib/breadcrumb-item/index.d.ts +1 -3
  54. package/lib/button/button.d.ts +4 -3
  55. package/lib/button/definition.d.ts +1 -0
  56. package/lib/button/index.d.ts +1 -21
  57. package/lib/calendar/calendar.d.ts +3 -1
  58. package/lib/calendar/definition.d.ts +1 -0
  59. package/lib/calendar/index.d.ts +1 -3
  60. package/lib/calendar-event/calendar-event.d.ts +14 -0
  61. package/lib/calendar-event/calendar-event.template.d.ts +4 -0
  62. package/lib/calendar-event/definition.d.ts +1 -0
  63. package/lib/calendar-event/index.d.ts +1 -0
  64. package/lib/card/card.d.ts +10 -0
  65. package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
  66. package/lib/card/definition.d.ts +1 -0
  67. package/lib/card/index.d.ts +1 -0
  68. package/lib/checkbox/checkbox.d.ts +5 -0
  69. package/lib/checkbox/checkbox.template.d.ts +4 -0
  70. package/lib/checkbox/definition.d.ts +1 -0
  71. package/lib/checkbox/index.d.ts +1 -0
  72. package/lib/combobox/combobox.d.ts +14 -0
  73. package/lib/combobox/combobox.template.d.ts +4 -0
  74. package/lib/combobox/definition.d.ts +3 -0
  75. package/lib/combobox/index.d.ts +1 -0
  76. package/lib/components.d.ts +44 -16
  77. package/lib/dialog/definition.d.ts +1 -0
  78. package/lib/dialog/dialog.d.ts +23 -0
  79. package/lib/dialog/dialog.template.d.ts +4 -0
  80. package/lib/dialog/index.d.ts +1 -0
  81. package/lib/divider/definition.d.ts +1 -0
  82. package/lib/divider/divider.d.ts +3 -0
  83. package/lib/divider/divider.template.d.ts +4 -0
  84. package/lib/divider/index.d.ts +1 -0
  85. package/lib/elevation/definition.d.ts +1 -0
  86. package/lib/elevation/elevation.d.ts +1 -0
  87. package/lib/elevation/index.d.ts +1 -2
  88. package/lib/enums.d.ts +20 -6
  89. package/lib/fab/definition.d.ts +3 -0
  90. package/lib/fab/fab.d.ts +13 -0
  91. package/lib/fab/fab.template.d.ts +4 -0
  92. package/lib/fab/index.d.ts +1 -0
  93. package/lib/focus/definition.d.ts +3 -0
  94. package/lib/focus/index.d.ts +1 -2
  95. package/lib/{sidenav-item/index.d.ts → header/definition.d.ts} +2 -2
  96. package/lib/header/header.d.ts +5 -0
  97. package/lib/header/header.template.d.ts +4 -0
  98. package/lib/header/index.d.ts +1 -0
  99. package/lib/icon/definition.d.ts +3 -0
  100. package/lib/icon/icon.d.ts +5 -6
  101. package/lib/icon/index.d.ts +1 -2
  102. package/lib/layout/definition.d.ts +3 -0
  103. package/lib/layout/index.d.ts +1 -2
  104. package/lib/layout/layout.d.ts +4 -4
  105. package/lib/listbox/definition.d.ts +3 -0
  106. package/lib/listbox/index.d.ts +1 -0
  107. package/lib/listbox/listbox.d.ts +6 -0
  108. package/lib/listbox/listbox.template.d.ts +4 -0
  109. package/lib/menu/definition.d.ts +11 -0
  110. package/lib/menu/index.d.ts +1 -0
  111. package/lib/menu/menu.d.ts +10 -0
  112. package/lib/menu/menu.template.d.ts +3 -0
  113. package/lib/menu-item/definition.d.ts +3 -0
  114. package/lib/menu-item/index.d.ts +1 -0
  115. package/lib/menu-item/menu-item.d.ts +8 -0
  116. package/lib/menu-item/menu-item.template.d.ts +5 -0
  117. package/lib/nav/definition.d.ts +3 -0
  118. package/lib/nav/index.d.ts +1 -0
  119. package/lib/nav/nav.d.ts +3 -0
  120. package/lib/nav/nav.template.d.ts +4 -0
  121. package/lib/nav-disclosure/definition.d.ts +3 -0
  122. package/lib/nav-disclosure/index.d.ts +1 -0
  123. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
  124. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
  125. package/lib/nav-item/definition.d.ts +3 -0
  126. package/lib/nav-item/index.d.ts +1 -0
  127. package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
  128. package/lib/nav-item/nav-item.template.d.ts +4 -0
  129. package/lib/note/definition.d.ts +3 -0
  130. package/lib/note/index.d.ts +1 -0
  131. package/lib/note/note.d.ts +10 -0
  132. package/lib/note/note.template.d.ts +4 -0
  133. package/lib/number-field/definition.d.ts +4 -0
  134. package/lib/number-field/index.d.ts +1 -0
  135. package/lib/number-field/number-field.d.ts +14 -0
  136. package/lib/number-field/number-field.template.d.ts +4 -0
  137. package/lib/option/definition.d.ts +3 -0
  138. package/lib/option/index.d.ts +1 -0
  139. package/lib/option/option.d.ts +9 -0
  140. package/lib/option/option.template.d.ts +4 -0
  141. package/lib/popup/definition.d.ts +4 -0
  142. package/lib/popup/index.d.ts +1 -4
  143. package/lib/popup/popup.d.ts +8 -4
  144. package/lib/progress/definition.d.ts +3 -0
  145. package/lib/progress/index.d.ts +1 -2
  146. package/lib/progress/progress.d.ts +1 -1
  147. package/lib/progress-ring/definition.d.ts +3 -0
  148. package/lib/progress-ring/index.d.ts +1 -2
  149. package/lib/progress-ring/progress-ring.d.ts +2 -1
  150. package/lib/radio/definition.d.ts +3 -0
  151. package/lib/radio/index.d.ts +1 -0
  152. package/lib/radio/radio.d.ts +4 -0
  153. package/lib/radio/radio.template.d.ts +4 -0
  154. package/lib/radio-group/definition.d.ts +11 -0
  155. package/lib/radio-group/index.d.ts +1 -0
  156. package/lib/radio-group/radio-group.d.ts +4 -0
  157. package/lib/radio-group/radio-group.template.d.ts +4 -0
  158. package/lib/select/definition.d.ts +3 -0
  159. package/lib/select/index.d.ts +1 -0
  160. package/lib/select/select.d.ts +17 -0
  161. package/lib/select/select.template.d.ts +4 -0
  162. package/lib/side-drawer/definition.d.ts +3 -0
  163. package/lib/side-drawer/index.d.ts +1 -2
  164. package/lib/side-drawer/side-drawer.d.ts +3 -2
  165. package/lib/slider/definition.d.ts +3 -0
  166. package/lib/slider/index.d.ts +1 -0
  167. package/lib/slider/slider.d.ts +4 -0
  168. package/lib/slider/slider.template.d.ts +4 -0
  169. package/lib/switch/definition.d.ts +3 -0
  170. package/lib/switch/index.d.ts +1 -0
  171. package/lib/switch/switch.d.ts +7 -0
  172. package/lib/switch/switch.template.d.ts +4 -0
  173. package/lib/tab/definition.d.ts +3 -0
  174. package/lib/tab/index.d.ts +1 -0
  175. package/lib/tab/tab.d.ts +9 -0
  176. package/lib/tab/tab.template.d.ts +3 -0
  177. package/lib/tab-panel/definition.d.ts +3 -0
  178. package/lib/tab-panel/index.d.ts +1 -0
  179. package/lib/tab-panel/tab-panel.d.ts +3 -0
  180. package/lib/tab-panel/tab-panel.template.d.ts +2 -0
  181. package/lib/tabs/definition.d.ts +3 -0
  182. package/lib/tabs/index.d.ts +1 -0
  183. package/lib/tabs/tabs.d.ts +10 -0
  184. package/lib/tabs/tabs.template.d.ts +2 -0
  185. package/lib/text-anchor/definition.d.ts +3 -0
  186. package/lib/text-anchor/index.d.ts +1 -2
  187. package/lib/text-anchor/text-anchor.d.ts +1 -1
  188. package/lib/text-area/definition.d.ts +3 -0
  189. package/lib/text-area/index.d.ts +1 -0
  190. package/lib/text-area/text-area.d.ts +9 -0
  191. package/lib/text-area/text-area.template.d.ts +4 -0
  192. package/lib/text-field/definition.d.ts +3 -0
  193. package/lib/text-field/index.d.ts +1 -0
  194. package/lib/text-field/text-field.d.ts +14 -0
  195. package/lib/text-field/text-field.template.d.ts +4 -0
  196. package/lib/tooltip/definition.d.ts +3 -0
  197. package/lib/tooltip/index.d.ts +1 -3
  198. package/lib/tooltip/tooltip.d.ts +7 -7
  199. package/listbox/index.js +27 -0
  200. package/menu/index.js +30 -0
  201. package/menu-item/index.js +20 -0
  202. package/nav/index.js +4 -0
  203. package/nav-disclosure/index.js +17 -0
  204. package/nav-item/index.js +22 -0
  205. package/note/index.js +15 -0
  206. package/number-field/index.js +459 -0
  207. package/option/index.js +21 -0
  208. package/package.json +29 -19
  209. package/popup/index.js +21 -2061
  210. package/progress/index.js +6 -97
  211. package/progress-ring/index.js +6 -75
  212. package/radio/index.js +12 -0
  213. package/radio-group/index.js +11 -0
  214. package/select/index.js +34 -0
  215. package/shared/affix.js +2 -8
  216. package/shared/anchor.js +10 -2
  217. package/shared/apply-mixins.js +5 -4
  218. package/shared/aria-global.js +2 -86
  219. package/shared/aria.js +9 -0
  220. package/shared/base-progress.js +5 -0
  221. package/shared/breadcrumb-item.js +1 -1
  222. package/shared/button.js +200 -0
  223. package/shared/calendar-event.js +19 -0
  224. package/shared/definition.js +225 -0
  225. package/shared/definition10.js +99 -0
  226. package/shared/definition11.js +48 -0
  227. package/shared/definition12.js +1523 -0
  228. package/shared/definition13.js +111 -0
  229. package/shared/definition14.js +114 -0
  230. package/shared/definition15.js +32 -0
  231. package/shared/definition16.js +172 -0
  232. package/shared/definition17.js +727 -0
  233. package/shared/definition18.js +1842 -0
  234. package/shared/definition19.js +261 -0
  235. package/shared/definition2.js +150 -0
  236. package/shared/definition20.js +221 -0
  237. package/shared/definition21.js +78 -0
  238. package/shared/definition22.js +87 -0
  239. package/shared/definition23.js +58 -0
  240. package/shared/definition24.js +44 -0
  241. package/shared/definition25.js +58 -0
  242. package/shared/definition26.js +348 -0
  243. package/shared/definition27.js +363 -0
  244. package/shared/definition28.js +21 -0
  245. package/shared/definition29.js +75 -0
  246. package/shared/definition3.js +29 -0
  247. package/shared/definition30.js +31 -0
  248. package/shared/definition31.js +49 -0
  249. package/shared/definition32.js +94 -0
  250. package/shared/definition33.js +77 -0
  251. package/shared/definition34.js +45 -0
  252. package/shared/definition35.js +435 -0
  253. package/shared/definition36.js +634 -0
  254. package/shared/definition37.js +86 -0
  255. package/shared/definition38.js +592 -0
  256. package/shared/definition39.js +147 -0
  257. package/shared/definition4.js +19 -0
  258. package/shared/definition40.js +67 -0
  259. package/shared/definition41.js +32 -0
  260. package/shared/definition42.js +440 -0
  261. package/shared/definition43.js +282 -0
  262. package/shared/definition44.js +119 -0
  263. package/shared/definition45.js +77 -0
  264. package/shared/definition5.js +38 -0
  265. package/shared/definition6.js +60 -0
  266. package/shared/definition7.js +45 -0
  267. package/shared/definition8.js +113 -0
  268. package/shared/definition9.js +107 -0
  269. package/shared/design-system/index.d.ts +1 -1
  270. package/shared/dialog-polyfill.esm.js +858 -0
  271. package/shared/direction.js +20 -0
  272. package/shared/dom.js +8 -0
  273. package/shared/enums.js +70 -0
  274. package/shared/es.object.assign.js +2 -2
  275. package/shared/es.regexp.to-string.js +59 -0
  276. package/shared/focus.js +5 -0
  277. package/shared/focus2.js +11 -0
  278. package/shared/form-associated.js +466 -0
  279. package/shared/form-elements.js +127 -0
  280. package/shared/icon.js +538 -572
  281. package/shared/index.js +1664 -83
  282. package/shared/key-codes.js +97 -0
  283. package/shared/listbox.js +995 -0
  284. package/shared/numbers.js +34 -0
  285. package/shared/patterns/affix.d.ts +1 -1
  286. package/shared/patterns/focus.d.ts +3 -0
  287. package/shared/patterns/form-elements/form-elements.d.ts +43 -0
  288. package/shared/patterns/form-elements/index.d.ts +1 -0
  289. package/shared/patterns/index.d.ts +2 -0
  290. package/shared/radio.js +127 -0
  291. package/shared/ref.js +41 -0
  292. package/shared/select.options.js +10 -0
  293. package/shared/start-end.js +50 -0
  294. package/shared/string-trim.js +40 -0
  295. package/shared/strings.js +9 -0
  296. package/shared/text-anchor.js +2 -13
  297. package/shared/text-anchor.template.js +6 -5
  298. package/shared/text-field.js +3 -0
  299. package/shared/text-field2.js +225 -0
  300. package/shared/to-string.js +51 -0
  301. package/side-drawer/index.js +5 -80
  302. package/slider/index.js +17 -0
  303. package/styles/core/all.css +83 -0
  304. package/styles/core/theme.css +11 -0
  305. package/styles/core/typography.css +77 -0
  306. package/styles/tokens/theme-dark.css +228 -0
  307. package/styles/tokens/theme-light.css +228 -0
  308. package/switch/index.js +18 -0
  309. package/tab/index.js +16 -0
  310. package/tab-panel/index.js +4 -0
  311. package/tabs/index.js +24 -0
  312. package/text-anchor/index.js +11 -5
  313. package/text-area/index.js +23 -0
  314. package/text-field/index.js +24 -0
  315. package/tooltip/index.js +18 -57
  316. package/lib/text/index.d.ts +0 -2
  317. package/lib/text/text.d.ts +0 -10
  318. package/shared/index2.js +0 -21
  319. package/shared/style-inject.es.js +0 -28
  320. package/shared/web.dom-collections.iterator.js +0 -1479
  321. package/sidenav-item/index.js +0 -38
  322. package/styles/fonts/spezia.css +0 -23
  323. package/styles/themes/dark.css +0 -205
  324. package/styles/themes/light.css +0 -205
  325. package/text/index.js +0 -45
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Expose ltr and rtl strings
3
+ */
4
+ var Direction;
5
+ (function (Direction) {
6
+ Direction["ltr"] = "ltr";
7
+ Direction["rtl"] = "rtl";
8
+ })(Direction || (Direction = {}));
9
+
10
+ /**
11
+ * a method to determine the current localization direction of the view
12
+ * @param rootNode - the HTMLElement to begin the query from, usually "this" when used in a component controller
13
+ * @public
14
+ */
15
+ const getDirection = (rootNode) => {
16
+ const dirNode = rootNode.closest("[dir]");
17
+ return dirNode !== null && dirNode.dir === "rtl" ? Direction.rtl : Direction.ltr;
18
+ };
19
+
20
+ export { Direction as D, getDirection as g };
package/shared/dom.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A test that ensures that all arguments are HTML Elements
3
+ */
4
+ function isHTMLElement(...args) {
5
+ return args.every((arg) => arg instanceof HTMLElement);
6
+ }
7
+
8
+ export { isHTMLElement as i };
@@ -0,0 +1,70 @@
1
+ var Connotation;
2
+ (function (Connotation) {
3
+ Connotation["Accent"] = "accent";
4
+ Connotation["CTA"] = "cta";
5
+ Connotation["Success"] = "success";
6
+ Connotation["Alert"] = "alert";
7
+ Connotation["Warning"] = "warning";
8
+ Connotation["Information"] = "information";
9
+ Connotation["Announcement"] = "announcement";
10
+ })(Connotation || (Connotation = {}));
11
+ var ConnotationDecorative;
12
+ (function (ConnotationDecorative) {
13
+ ConnotationDecorative["Pacific"] = "pacific";
14
+ })(ConnotationDecorative || (ConnotationDecorative = {}));
15
+ var Shape;
16
+ (function (Shape) {
17
+ Shape["Rounded"] = "rounded";
18
+ Shape["Pill"] = "pill";
19
+ Shape["Circled"] = "circled";
20
+ Shape["Sharp"] = "sharp";
21
+ })(Shape || (Shape = {}));
22
+ var Appearance;
23
+ (function (Appearance) {
24
+ Appearance["Filled"] = "filled";
25
+ Appearance["Outlined"] = "outlined";
26
+ Appearance["Duotone"] = "duotone";
27
+ Appearance["Fieldset"] = "fieldset";
28
+ Appearance["Subtle"] = "subtle";
29
+ Appearance["Ghost"] = "ghost";
30
+ })(Appearance || (Appearance = {}));
31
+ var Size;
32
+ (function (Size) {
33
+ Size["UltraCondensed"] = "ultraCondensed";
34
+ Size["SuperCondensed"] = "superCondensed";
35
+ Size["ExtraCondensed"] = "extraCondensed";
36
+ Size["SemiCondensed"] = "semiCondensed";
37
+ Size["Condensed"] = "condensed";
38
+ Size["Normal"] = "normal";
39
+ Size["SemiExpanded"] = "semiExpanded";
40
+ Size["Expanded"] = "expanded";
41
+ Size["ExtraExpanded"] = "extraExpanded";
42
+ Size["SuperExpanded"] = "superExpanded";
43
+ Size["UltraExpanded"] = "ultraExpanded";
44
+ })(Size || (Size = {}));
45
+ var LayoutSize;
46
+ (function (LayoutSize) {
47
+ LayoutSize["Small"] = "small";
48
+ LayoutSize["Medium"] = "medium";
49
+ LayoutSize["Large"] = "large";
50
+ })(LayoutSize || (LayoutSize = {}));
51
+ var Position;
52
+ (function (Position) {
53
+ Position["Top"] = "TOP";
54
+ Position["Bottom"] = "BOTTOM";
55
+ Position["Start"] = "START";
56
+ Position["Center"] = "CENTER";
57
+ Position["End"] = "END";
58
+ })(Position || (Position = {}));
59
+ var Role;
60
+ (function (Role) {
61
+ Role["Status"] = "status";
62
+ Role["Alert"] = "alert";
63
+ })(Role || (Role = {}));
64
+ var AriaLive;
65
+ (function (AriaLive) {
66
+ AriaLive["Polite"] = "polite";
67
+ AriaLive["Assertive"] = "assertive";
68
+ })(AriaLive || (AriaLive = {}));
69
+
70
+ export { Connotation as C, Shape as S };
@@ -1,4 +1,4 @@
1
- import { d as descriptors, f as functionUncurryThis, l as functionCall, p as fails$1, H as objectKeys$1, I as toObject$1, J as indexedObject, K as objectGetOwnPropertySymbols, L as objectPropertyIsEnumerable, _ as _export } from './web.dom-collections.iterator.js';
1
+ import { i as descriptors, k as functionUncurryThis, K as functionCall, l as fails$1, $ as objectKeys$1, a0 as toObject$1, a1 as indexedObject, a2 as objectGetOwnPropertySymbols, a3 as objectPropertyIsEnumerable, G as _export } from './index.js';
2
2
 
3
3
  var DESCRIPTORS = descriptors;
4
4
  var uncurryThis = functionUncurryThis;
@@ -63,6 +63,6 @@ var assign = objectAssign;
63
63
  // `Object.assign` method
64
64
  // https://tc39.es/ecma262/#sec-object.assign
65
65
  // eslint-disable-next-line es/no-object-assign -- required for testing
66
- $({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
66
+ $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
67
67
  assign: assign
68
68
  });
@@ -0,0 +1,59 @@
1
+ import { q as anObject$2, K as functionCall, B as hasOwnProperty_1, j as objectIsPrototypeOf, R as functionName, H as defineBuiltIn$1, l as fails$1 } from './index.js';
2
+ import { t as toString } from './to-string.js';
3
+
4
+ var anObject$1 = anObject$2;
5
+
6
+ // `RegExp.prototype.flags` getter implementation
7
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
8
+ var regexpFlags = function () {
9
+ var that = anObject$1(this);
10
+ var result = '';
11
+ if (that.hasIndices) result += 'd';
12
+ if (that.global) result += 'g';
13
+ if (that.ignoreCase) result += 'i';
14
+ if (that.multiline) result += 'm';
15
+ if (that.dotAll) result += 's';
16
+ if (that.unicode) result += 'u';
17
+ if (that.unicodeSets) result += 'v';
18
+ if (that.sticky) result += 'y';
19
+ return result;
20
+ };
21
+
22
+ var call = functionCall;
23
+ var hasOwn = hasOwnProperty_1;
24
+ var isPrototypeOf = objectIsPrototypeOf;
25
+ var regExpFlags = regexpFlags;
26
+
27
+ var RegExpPrototype$1 = RegExp.prototype;
28
+
29
+ var regexpGetFlags = function (R) {
30
+ var flags = R.flags;
31
+ return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype$1, R)
32
+ ? call(regExpFlags, R) : flags;
33
+ };
34
+
35
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
36
+ var defineBuiltIn = defineBuiltIn$1;
37
+ var anObject = anObject$2;
38
+ var $toString = toString;
39
+ var fails = fails$1;
40
+ var getRegExpFlags = regexpGetFlags;
41
+
42
+ var TO_STRING = 'toString';
43
+ var RegExpPrototype = RegExp.prototype;
44
+ var nativeToString = RegExpPrototype[TO_STRING];
45
+
46
+ var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
47
+ // FF44- RegExp#toString has a wrong name
48
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name != TO_STRING;
49
+
50
+ // `RegExp.prototype.toString` method
51
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
52
+ if (NOT_GENERIC || INCORRECT_NAME) {
53
+ defineBuiltIn(RegExp.prototype, TO_STRING, function toString() {
54
+ var R = anObject(this);
55
+ var pattern = $toString(R.source);
56
+ var flags = $toString(getRegExpFlags(R));
57
+ return '/' + pattern + '/' + flags;
58
+ }, { unsafe: true });
59
+ }
@@ -0,0 +1,5 @@
1
+ import { F as FoundationElement } from './index.js';
2
+
3
+ class Focus extends FoundationElement {}
4
+
5
+ export { Focus as F };
@@ -0,0 +1,11 @@
1
+ import { F as Focus } from './focus.js';
2
+ import { h as html } from './index.js';
3
+
4
+ let _ = t => t,
5
+ _t;
6
+ const focusTemplateFactory = context => {
7
+ const focusTag = context.tagFor(Focus);
8
+ return html(_t || (_t = _`<${0} class="focus-indicator"></${0}>`), focusTag, focusTag);
9
+ };
10
+
11
+ export { focusTemplateFactory as f };
@@ -0,0 +1,466 @@
1
+ import { a as attr, o as observable, V as booleanConverter, e as emptyArray, W as DOM } from './index.js';
2
+ import { d as keyEnter } from './key-codes.js';
3
+
4
+ const proxySlotName = "form-associated-proxy";
5
+ const ElementInternalsKey = "ElementInternals";
6
+ /**
7
+ * @alpha
8
+ */
9
+ const supportsElementInternals = ElementInternalsKey in window &&
10
+ "setFormValue" in window[ElementInternalsKey].prototype;
11
+ const InternalsMap = new WeakMap();
12
+ /**
13
+ * Base function for providing Custom Element Form Association.
14
+ *
15
+ * @alpha
16
+ */
17
+ function FormAssociated(BaseCtor) {
18
+ const C = class extends BaseCtor {
19
+ constructor(...args) {
20
+ super(...args);
21
+ /**
22
+ * Track whether the value has been changed from the initial value
23
+ */
24
+ this.dirtyValue = false;
25
+ /**
26
+ * Sets the element's disabled state. A disabled element will not be included during form submission.
27
+ *
28
+ * @remarks
29
+ * HTML Attribute: disabled
30
+ */
31
+ this.disabled = false;
32
+ /**
33
+ * These are events that are still fired by the proxy
34
+ * element based on user / programmatic interaction.
35
+ *
36
+ * The proxy implementation should be transparent to
37
+ * the app author, so block these events from emitting.
38
+ */
39
+ this.proxyEventsToBlock = ["change", "click"];
40
+ this.proxyInitialized = false;
41
+ this.required = false;
42
+ this.initialValue = this.initialValue || "";
43
+ if (!this.elementInternals) {
44
+ // When elementInternals is not supported, formResetCallback is
45
+ // bound to an event listener, so ensure the handler's `this`
46
+ // context is correct.
47
+ this.formResetCallback = this.formResetCallback.bind(this);
48
+ }
49
+ }
50
+ /**
51
+ * Must evaluate to true to enable elementInternals.
52
+ * Feature detects API support and resolve respectively
53
+ *
54
+ * @internal
55
+ */
56
+ static get formAssociated() {
57
+ return supportsElementInternals;
58
+ }
59
+ /**
60
+ * Returns the validity state of the element
61
+ *
62
+ * @alpha
63
+ */
64
+ get validity() {
65
+ return this.elementInternals
66
+ ? this.elementInternals.validity
67
+ : this.proxy.validity;
68
+ }
69
+ /**
70
+ * Retrieve a reference to the associated form.
71
+ * Returns null if not associated to any form.
72
+ *
73
+ * @alpha
74
+ */
75
+ get form() {
76
+ return this.elementInternals ? this.elementInternals.form : this.proxy.form;
77
+ }
78
+ /**
79
+ * Retrieve the localized validation message,
80
+ * or custom validation message if set.
81
+ *
82
+ * @alpha
83
+ */
84
+ get validationMessage() {
85
+ return this.elementInternals
86
+ ? this.elementInternals.validationMessage
87
+ : this.proxy.validationMessage;
88
+ }
89
+ /**
90
+ * Whether the element will be validated when the
91
+ * form is submitted
92
+ */
93
+ get willValidate() {
94
+ return this.elementInternals
95
+ ? this.elementInternals.willValidate
96
+ : this.proxy.willValidate;
97
+ }
98
+ /**
99
+ * A reference to all associated label elements
100
+ */
101
+ get labels() {
102
+ if (this.elementInternals) {
103
+ return Object.freeze(Array.from(this.elementInternals.labels));
104
+ }
105
+ else if (this.proxy instanceof HTMLElement &&
106
+ this.proxy.ownerDocument &&
107
+ this.id) {
108
+ // Labels associated by wrapping the element: <label><custom-element></custom-element></label>
109
+ const parentLabels = this.proxy.labels;
110
+ // Labels associated using the `for` attribute
111
+ const forLabels = Array.from(this.proxy.getRootNode().querySelectorAll(`[for='${this.id}']`));
112
+ const labels = parentLabels
113
+ ? forLabels.concat(Array.from(parentLabels))
114
+ : forLabels;
115
+ return Object.freeze(labels);
116
+ }
117
+ else {
118
+ return emptyArray;
119
+ }
120
+ }
121
+ /**
122
+ * Invoked when the `value` property changes
123
+ * @param previous - the previous value
124
+ * @param next - the new value
125
+ *
126
+ * @remarks
127
+ * If elements extending `FormAssociated` implement a `valueChanged` method
128
+ * They must be sure to invoke `super.valueChanged(previous, next)` to ensure
129
+ * proper functioning of `FormAssociated`
130
+ */
131
+ valueChanged(previous, next) {
132
+ this.dirtyValue = true;
133
+ if (this.proxy instanceof HTMLElement) {
134
+ this.proxy.value = this.value;
135
+ }
136
+ this.currentValue = this.value;
137
+ this.setFormValue(this.value);
138
+ this.validate();
139
+ }
140
+ currentValueChanged() {
141
+ this.value = this.currentValue;
142
+ }
143
+ /**
144
+ * Invoked when the `initialValue` property changes
145
+ *
146
+ * @param previous - the previous value
147
+ * @param next - the new value
148
+ *
149
+ * @remarks
150
+ * If elements extending `FormAssociated` implement a `initialValueChanged` method
151
+ * They must be sure to invoke `super.initialValueChanged(previous, next)` to ensure
152
+ * proper functioning of `FormAssociated`
153
+ */
154
+ initialValueChanged(previous, next) {
155
+ // If the value is clean and the component is connected to the DOM
156
+ // then set value equal to the attribute value.
157
+ if (!this.dirtyValue) {
158
+ this.value = this.initialValue;
159
+ this.dirtyValue = false;
160
+ }
161
+ }
162
+ /**
163
+ * Invoked when the `disabled` property changes
164
+ *
165
+ * @param previous - the previous value
166
+ * @param next - the new value
167
+ *
168
+ * @remarks
169
+ * If elements extending `FormAssociated` implement a `disabledChanged` method
170
+ * They must be sure to invoke `super.disabledChanged(previous, next)` to ensure
171
+ * proper functioning of `FormAssociated`
172
+ */
173
+ disabledChanged(previous, next) {
174
+ if (this.proxy instanceof HTMLElement) {
175
+ this.proxy.disabled = this.disabled;
176
+ }
177
+ DOM.queueUpdate(() => this.classList.toggle("disabled", this.disabled));
178
+ }
179
+ /**
180
+ * Invoked when the `name` property changes
181
+ *
182
+ * @param previous - the previous value
183
+ * @param next - the new value
184
+ *
185
+ * @remarks
186
+ * If elements extending `FormAssociated` implement a `nameChanged` method
187
+ * They must be sure to invoke `super.nameChanged(previous, next)` to ensure
188
+ * proper functioning of `FormAssociated`
189
+ */
190
+ nameChanged(previous, next) {
191
+ if (this.proxy instanceof HTMLElement) {
192
+ this.proxy.name = this.name;
193
+ }
194
+ }
195
+ /**
196
+ * Invoked when the `required` property changes
197
+ *
198
+ * @param previous - the previous value
199
+ * @param next - the new value
200
+ *
201
+ * @remarks
202
+ * If elements extending `FormAssociated` implement a `requiredChanged` method
203
+ * They must be sure to invoke `super.requiredChanged(previous, next)` to ensure
204
+ * proper functioning of `FormAssociated`
205
+ */
206
+ requiredChanged(prev, next) {
207
+ if (this.proxy instanceof HTMLElement) {
208
+ this.proxy.required = this.required;
209
+ }
210
+ DOM.queueUpdate(() => this.classList.toggle("required", this.required));
211
+ this.validate();
212
+ }
213
+ /**
214
+ * The element internals object. Will only exist
215
+ * in browsers supporting the attachInternals API
216
+ */
217
+ get elementInternals() {
218
+ if (!supportsElementInternals) {
219
+ return null;
220
+ }
221
+ let internals = InternalsMap.get(this);
222
+ if (!internals) {
223
+ internals = this.attachInternals();
224
+ InternalsMap.set(this, internals);
225
+ }
226
+ return internals;
227
+ }
228
+ /**
229
+ * @internal
230
+ */
231
+ connectedCallback() {
232
+ super.connectedCallback();
233
+ this.addEventListener("keypress", this._keypressHandler);
234
+ if (!this.value) {
235
+ this.value = this.initialValue;
236
+ this.dirtyValue = false;
237
+ }
238
+ if (!this.elementInternals) {
239
+ this.attachProxy();
240
+ if (this.form) {
241
+ this.form.addEventListener("reset", this.formResetCallback);
242
+ }
243
+ }
244
+ }
245
+ /**
246
+ * @internal
247
+ */
248
+ disconnectedCallback() {
249
+ this.proxyEventsToBlock.forEach(name => this.proxy.removeEventListener(name, this.stopPropagation));
250
+ if (!this.elementInternals && this.form) {
251
+ this.form.removeEventListener("reset", this.formResetCallback);
252
+ }
253
+ }
254
+ /**
255
+ * Return the current validity of the element.
256
+ */
257
+ checkValidity() {
258
+ return this.elementInternals
259
+ ? this.elementInternals.checkValidity()
260
+ : this.proxy.checkValidity();
261
+ }
262
+ /**
263
+ * Return the current validity of the element.
264
+ * If false, fires an invalid event at the element.
265
+ */
266
+ reportValidity() {
267
+ return this.elementInternals
268
+ ? this.elementInternals.reportValidity()
269
+ : this.proxy.reportValidity();
270
+ }
271
+ /**
272
+ * Set the validity of the control. In cases when the elementInternals object is not
273
+ * available (and the proxy element is used to report validity), this function will
274
+ * do nothing unless a message is provided, at which point the setCustomValidity method
275
+ * of the proxy element will be invoked with the provided message.
276
+ * @param flags - Validity flags
277
+ * @param message - Optional message to supply
278
+ * @param anchor - Optional element used by UA to display an interactive validation UI
279
+ */
280
+ setValidity(flags, message, anchor) {
281
+ if (this.elementInternals) {
282
+ this.elementInternals.setValidity(flags, message, anchor);
283
+ }
284
+ else if (typeof message === "string") {
285
+ this.proxy.setCustomValidity(message);
286
+ }
287
+ }
288
+ /**
289
+ * Invoked when a connected component's form or fieldset has its disabled
290
+ * state changed.
291
+ * @param disabled - the disabled value of the form / fieldset
292
+ */
293
+ formDisabledCallback(disabled) {
294
+ this.disabled = disabled;
295
+ }
296
+ formResetCallback() {
297
+ this.value = this.initialValue;
298
+ this.dirtyValue = false;
299
+ }
300
+ /**
301
+ * Attach the proxy element to the DOM
302
+ */
303
+ attachProxy() {
304
+ var _a;
305
+ if (!this.proxyInitialized) {
306
+ this.proxyInitialized = true;
307
+ this.proxy.style.display = "none";
308
+ this.proxyEventsToBlock.forEach(name => this.proxy.addEventListener(name, this.stopPropagation));
309
+ // These are typically mapped to the proxy during
310
+ // property change callbacks, but during initialization
311
+ // on the initial call of the callback, the proxy is
312
+ // still undefined. We should find a better way to address this.
313
+ this.proxy.disabled = this.disabled;
314
+ this.proxy.required = this.required;
315
+ if (typeof this.name === "string") {
316
+ this.proxy.name = this.name;
317
+ }
318
+ if (typeof this.value === "string") {
319
+ this.proxy.value = this.value;
320
+ }
321
+ this.proxy.setAttribute("slot", proxySlotName);
322
+ this.proxySlot = document.createElement("slot");
323
+ this.proxySlot.setAttribute("name", proxySlotName);
324
+ }
325
+ (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(this.proxySlot);
326
+ this.appendChild(this.proxy);
327
+ }
328
+ /**
329
+ * Detach the proxy element from the DOM
330
+ */
331
+ detachProxy() {
332
+ var _a;
333
+ this.removeChild(this.proxy);
334
+ (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeChild(this.proxySlot);
335
+ }
336
+ /** {@inheritDoc (FormAssociated:interface).validate} */
337
+ validate(anchor) {
338
+ if (this.proxy instanceof HTMLElement) {
339
+ this.setValidity(this.proxy.validity, this.proxy.validationMessage, anchor);
340
+ }
341
+ }
342
+ /**
343
+ * Associates the provided value (and optional state) with the parent form.
344
+ * @param value - The value to set
345
+ * @param state - The state object provided to during session restores and when autofilling.
346
+ */
347
+ setFormValue(value, state) {
348
+ if (this.elementInternals) {
349
+ this.elementInternals.setFormValue(value, state || value);
350
+ }
351
+ }
352
+ _keypressHandler(e) {
353
+ switch (e.key) {
354
+ case keyEnter:
355
+ if (this.form instanceof HTMLFormElement) {
356
+ // Implicit submission
357
+ const defaultButton = this.form.querySelector("[type=submit]");
358
+ defaultButton === null || defaultButton === void 0 ? void 0 : defaultButton.click();
359
+ }
360
+ break;
361
+ }
362
+ }
363
+ /**
364
+ * Used to stop propagation of proxy element events
365
+ * @param e - Event object
366
+ */
367
+ stopPropagation(e) {
368
+ e.stopPropagation();
369
+ }
370
+ };
371
+ attr({ mode: "boolean" })(C.prototype, "disabled");
372
+ attr({ mode: "fromView", attribute: "value" })(C.prototype, "initialValue");
373
+ attr({ attribute: "current-value" })(C.prototype, "currentValue");
374
+ attr(C.prototype, "name");
375
+ attr({ mode: "boolean" })(C.prototype, "required");
376
+ observable(C.prototype, "value");
377
+ return C;
378
+ }
379
+ /**
380
+ * @alpha
381
+ */
382
+ function CheckableFormAssociated(BaseCtor) {
383
+ class C extends FormAssociated(BaseCtor) {
384
+ }
385
+ class D extends C {
386
+ constructor(...args) {
387
+ super(args);
388
+ /**
389
+ * Tracks whether the "checked" property has been changed.
390
+ * This is necessary to provide consistent behavior with
391
+ * normal input checkboxes
392
+ */
393
+ this.dirtyChecked = false;
394
+ /**
395
+ * Provides the default checkedness of the input element
396
+ * Passed down to proxy
397
+ *
398
+ * @public
399
+ * @remarks
400
+ * HTML Attribute: checked
401
+ */
402
+ this.checkedAttribute = false;
403
+ /**
404
+ * The checked state of the control.
405
+ *
406
+ * @public
407
+ */
408
+ this.checked = false;
409
+ // Re-initialize dirtyChecked because initialization of other values
410
+ // causes it to become true
411
+ this.dirtyChecked = false;
412
+ }
413
+ checkedAttributeChanged() {
414
+ this.defaultChecked = this.checkedAttribute;
415
+ }
416
+ /**
417
+ * @internal
418
+ */
419
+ defaultCheckedChanged() {
420
+ if (!this.dirtyChecked) {
421
+ // Setting this.checked will cause us to enter a dirty state,
422
+ // but if we are clean when defaultChecked is changed, we want to stay
423
+ // in a clean state, so reset this.dirtyChecked
424
+ this.checked = this.defaultChecked;
425
+ this.dirtyChecked = false;
426
+ }
427
+ }
428
+ checkedChanged(prev, next) {
429
+ if (!this.dirtyChecked) {
430
+ this.dirtyChecked = true;
431
+ }
432
+ this.currentChecked = this.checked;
433
+ this.updateForm();
434
+ if (this.proxy instanceof HTMLInputElement) {
435
+ this.proxy.checked = this.checked;
436
+ }
437
+ if (prev !== undefined) {
438
+ this.$emit("change");
439
+ }
440
+ this.validate();
441
+ }
442
+ currentCheckedChanged(prev, next) {
443
+ this.checked = this.currentChecked;
444
+ }
445
+ updateForm() {
446
+ const value = this.checked ? this.value : null;
447
+ this.setFormValue(value, value);
448
+ }
449
+ connectedCallback() {
450
+ super.connectedCallback();
451
+ this.updateForm();
452
+ }
453
+ formResetCallback() {
454
+ super.formResetCallback();
455
+ this.checked = !!this.checkedAttribute;
456
+ this.dirtyChecked = false;
457
+ }
458
+ }
459
+ attr({ attribute: "checked", mode: "boolean" })(D.prototype, "checkedAttribute");
460
+ attr({ attribute: "current-checked", converter: booleanConverter })(D.prototype, "currentChecked");
461
+ observable(D.prototype, "defaultChecked");
462
+ observable(D.prototype, "checked");
463
+ return D;
464
+ }
465
+
466
+ export { CheckableFormAssociated as C, FormAssociated as F };