@viasat/beam-web-components 2.0.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 (316) hide show
  1. package/Accordion/Accordion.d.ts +56 -0
  2. package/Accordion/Accordion.js +12 -0
  3. package/Accordion/AccordionGroup.context.d.ts +10 -0
  4. package/Accordion/AccordionGroup.context.js +8 -0
  5. package/Accordion/AccordionGroup.d.ts +33 -0
  6. package/Accordion/AccordionGroup.js +79 -0
  7. package/Accordion/index.d.ts +3 -0
  8. package/Accordion/index.js +6 -0
  9. package/Alert/Alert.d.ts +64 -0
  10. package/Alert/Alert.js +300 -0
  11. package/Alert/index.d.ts +2 -0
  12. package/Alert/index.js +4 -0
  13. package/Avatar/Avatar.d.ts +60 -0
  14. package/Avatar/Avatar.js +12 -0
  15. package/Avatar/AvatarGroup.context.d.ts +11 -0
  16. package/Avatar/AvatarGroup.context.js +8 -0
  17. package/Avatar/AvatarGroup.d.ts +43 -0
  18. package/Avatar/AvatarGroup.js +181 -0
  19. package/Avatar/index.d.ts +3 -0
  20. package/Avatar/index.js +6 -0
  21. package/Badge/Badge.d.ts +40 -0
  22. package/Badge/Badge.js +125 -0
  23. package/Badge/index.d.ts +2 -0
  24. package/Badge/index.js +4 -0
  25. package/BadgeDot/BadgeDot.d.ts +38 -0
  26. package/BadgeDot/BadgeDot.js +59 -0
  27. package/BadgeDot/index.d.ts +2 -0
  28. package/BadgeDot/index.js +4 -0
  29. package/Box/Box.d.ts +99 -0
  30. package/Box/Box.js +115 -0
  31. package/Box/index.d.ts +2 -0
  32. package/Box/index.js +4 -0
  33. package/Breadcrumbs/Breadcrumbs.context.d.ts +10 -0
  34. package/Breadcrumbs/Breadcrumbs.context.js +8 -0
  35. package/Breadcrumbs/Breadcrumbs.d.ts +38 -0
  36. package/Breadcrumbs/Breadcrumbs.js +115 -0
  37. package/Breadcrumbs/BreadcrumbsItem.d.ts +39 -0
  38. package/Breadcrumbs/BreadcrumbsItem.js +13 -0
  39. package/Breadcrumbs/index.d.ts +3 -0
  40. package/Breadcrumbs/index.js +6 -0
  41. package/Button/Button.d.ts +73 -0
  42. package/Button/Button.js +125 -0
  43. package/Button/index.d.ts +2 -0
  44. package/Button/index.js +4 -0
  45. package/CloseButton/CloseButton.d.ts +25 -0
  46. package/CloseButton/CloseButton.js +60 -0
  47. package/CloseButton/index.d.ts +2 -0
  48. package/CloseButton/index.js +4 -0
  49. package/Divider/Divider.d.ts +56 -0
  50. package/Divider/Divider.js +111 -0
  51. package/Divider/index.d.ts +2 -0
  52. package/Divider/index.js +4 -0
  53. package/EmptyState/EmptyState.d.ts +36 -0
  54. package/EmptyState/EmptyState.js +56 -0
  55. package/EmptyState/index.d.ts +2 -0
  56. package/EmptyState/index.js +4 -0
  57. package/HelperText/HelperText.d.ts +45 -0
  58. package/HelperText/HelperText.js +11 -0
  59. package/HelperText/index.d.ts +2 -0
  60. package/HelperText/index.js +4 -0
  61. package/Icon/Icon.d.ts +35 -0
  62. package/Icon/Icon.js +62 -0
  63. package/Icon/index.d.ts +2 -0
  64. package/Icon/index.js +4 -0
  65. package/InputChoiceGroup/InputChoiceGroup.context.d.ts +13 -0
  66. package/InputChoiceGroup/InputChoiceGroup.context.js +8 -0
  67. package/InputChoiceGroup/InputChoiceGroup.d.ts +87 -0
  68. package/InputChoiceGroup/InputChoiceGroup.js +205 -0
  69. package/InputChoiceGroup/index.d.ts +2 -0
  70. package/InputChoiceGroup/index.js +4 -0
  71. package/Link/Link.d.ts +48 -0
  72. package/Link/Link.js +77 -0
  73. package/Link/index.d.ts +2 -0
  74. package/Link/index.js +4 -0
  75. package/List/List.context.d.ts +15 -0
  76. package/List/List.context.js +8 -0
  77. package/List/List.d.ts +43 -0
  78. package/List/List.js +101 -0
  79. package/List/ListItem.d.ts +23 -0
  80. package/List/ListItem.js +90 -0
  81. package/List/index.d.ts +3 -0
  82. package/List/index.js +6 -0
  83. package/ProgressBar/ProgressBar.d.ts +52 -0
  84. package/ProgressBar/ProgressBar.js +128 -0
  85. package/ProgressBar/index.d.ts +2 -0
  86. package/ProgressBar/index.js +4 -0
  87. package/README.md +360 -0
  88. package/SegmentedControl/SegmentedControl.context.d.ts +16 -0
  89. package/SegmentedControl/SegmentedControl.context.js +8 -0
  90. package/SegmentedControl/SegmentedControl.d.ts +41 -0
  91. package/SegmentedControl/SegmentedControl.js +103 -0
  92. package/SegmentedControl/SegmentedControlItem.d.ts +54 -0
  93. package/SegmentedControl/SegmentedControlItem.js +284 -0
  94. package/SegmentedControl/SegmentedControlList.d.ts +23 -0
  95. package/SegmentedControl/SegmentedControlList.js +61 -0
  96. package/SegmentedControl/SegmentedControlPanel.d.ts +21 -0
  97. package/SegmentedControl/SegmentedControlPanel.js +43 -0
  98. package/SegmentedControl/index.d.ts +5 -0
  99. package/SegmentedControl/index.js +10 -0
  100. package/Spinner/Spinner.d.ts +50 -0
  101. package/Spinner/Spinner.js +186 -0
  102. package/Spinner/index.d.ts +2 -0
  103. package/Spinner/index.js +4 -0
  104. package/StateLayer/StateLayer.d.ts +17 -0
  105. package/StateLayer/StateLayer.js +6 -0
  106. package/StateLayer/index.d.ts +2 -0
  107. package/StateLayer/index.js +5 -0
  108. package/Text/Text.d.ts +85 -0
  109. package/Text/Text.js +103 -0
  110. package/Text/index.d.ts +2 -0
  111. package/Text/index.js +4 -0
  112. package/Tooltip/Tooltip.d.ts +139 -0
  113. package/Tooltip/Tooltip.js +1827 -0
  114. package/Tooltip/index.d.ts +2 -0
  115. package/Tooltip/index.js +5 -0
  116. package/chunks/Accordion.DYD3XcAx.js +161 -0
  117. package/chunks/Avatar.C2rfzUGP.js +174 -0
  118. package/chunks/BreadcrumbsItem.4ZR6wbMz.js +121 -0
  119. package/chunks/CSSLookup.BdqZ5Li9.js +106 -0
  120. package/chunks/HelperText.CcVVOtA3.js +108 -0
  121. package/chunks/Upload.B9YEyp7b.js +12 -0
  122. package/chunks/WarningOutlined.DPfQnPPj.js +12 -0
  123. package/chunks/classNames.Cq_tbDRp.js +94 -0
  124. package/chunks/constants.jOWREYQE.js +30 -0
  125. package/chunks/delegate.baxDQosr.js +63 -0
  126. package/chunks/dom.C98AFbJh.js +22 -0
  127. package/chunks/fileUpload.module.kN6o64aL.js +4 -0
  128. package/chunks/globals.Bz4SVF2g.js +4 -0
  129. package/chunks/helpers.AwJwaZvv.js +53 -0
  130. package/chunks/list.module.CZRPBLzy.js +4 -0
  131. package/chunks/register-custom-element.DHGKOhmA.js +17 -0
  132. package/chunks/segmentedControl.module.BPXEWodj.js +4 -0
  133. package/chunks/tokens.CTW8Tt94.js +9 -0
  134. package/custom-elements.json +11341 -0
  135. package/local/Accordion/Accordion.js +12 -0
  136. package/local/Accordion/AccordionGroup.context.js +8 -0
  137. package/local/Accordion/AccordionGroup.js +78 -0
  138. package/local/Accordion/index.js +6 -0
  139. package/local/Alert/Alert.js +301 -0
  140. package/local/Alert/index.js +4 -0
  141. package/local/Avatar/Avatar.js +11 -0
  142. package/local/Avatar/AvatarGroup.context.js +8 -0
  143. package/local/Avatar/AvatarGroup.js +180 -0
  144. package/local/Avatar/index.js +6 -0
  145. package/local/Badge/Badge.js +123 -0
  146. package/local/Badge/index.js +4 -0
  147. package/local/BadgeDot/BadgeDot.js +57 -0
  148. package/local/BadgeDot/index.js +4 -0
  149. package/local/Box/Box.js +113 -0
  150. package/local/Box/index.js +4 -0
  151. package/local/Breadcrumbs/Breadcrumbs.context.js +8 -0
  152. package/local/Breadcrumbs/Breadcrumbs.js +113 -0
  153. package/local/Breadcrumbs/BreadcrumbsItem.js +13 -0
  154. package/local/Breadcrumbs/index.js +6 -0
  155. package/local/Button/Button.js +154 -0
  156. package/local/Button/index.js +4 -0
  157. package/local/CloseButton/CloseButton.js +58 -0
  158. package/local/CloseButton/index.js +4 -0
  159. package/local/Divider/Divider.js +111 -0
  160. package/local/Divider/index.js +4 -0
  161. package/local/EmptyState/EmptyState.js +54 -0
  162. package/local/EmptyState/index.js +4 -0
  163. package/local/HelperText/HelperText.js +9 -0
  164. package/local/HelperText/index.js +4 -0
  165. package/local/Icon/Icon.js +60 -0
  166. package/local/Icon/index.js +4 -0
  167. package/local/InputChoiceGroup/InputChoiceGroup.context.js +8 -0
  168. package/local/InputChoiceGroup/InputChoiceGroup.js +205 -0
  169. package/local/InputChoiceGroup/index.js +4 -0
  170. package/local/Link/Link.js +75 -0
  171. package/local/Link/index.js +4 -0
  172. package/local/List/List.context.js +8 -0
  173. package/local/List/List.js +101 -0
  174. package/local/List/ListItem.js +90 -0
  175. package/local/List/index.js +6 -0
  176. package/local/ProgressBar/ProgressBar.js +126 -0
  177. package/local/ProgressBar/index.js +4 -0
  178. package/local/SegmentedControl/SegmentedControl.context.js +8 -0
  179. package/local/SegmentedControl/SegmentedControl.js +103 -0
  180. package/local/SegmentedControl/SegmentedControlItem.js +284 -0
  181. package/local/SegmentedControl/SegmentedControlList.js +59 -0
  182. package/local/SegmentedControl/SegmentedControlPanel.js +41 -0
  183. package/local/SegmentedControl/index.js +10 -0
  184. package/local/Spinner/Spinner.js +185 -0
  185. package/local/Spinner/index.js +4 -0
  186. package/local/StateLayer/StateLayer.js +6 -0
  187. package/local/StateLayer/index.js +5 -0
  188. package/local/Text/Text.js +121 -0
  189. package/local/Text/index.js +4 -0
  190. package/local/Tooltip/Tooltip.js +1826 -0
  191. package/local/Tooltip/index.js +5 -0
  192. package/local/chunks/Accordion.PGU7OILE.js +161 -0
  193. package/local/chunks/Avatar.CvTOzaRT.js +172 -0
  194. package/local/chunks/BreadcrumbsItem.GM6sBp_o.js +121 -0
  195. package/local/chunks/CSSLookup.BdqZ5Li9.js +106 -0
  196. package/local/chunks/Upload.B9YEyp7b.js +12 -0
  197. package/local/chunks/WarningOutlined.DPfQnPPj.js +12 -0
  198. package/local/chunks/base.D76d76ww.js +9 -0
  199. package/local/chunks/classNames.C6fNrXWF.js +106 -0
  200. package/local/chunks/constants.jOWREYQE.js +30 -0
  201. package/local/chunks/consume.Ce9k1-wN.js +47 -0
  202. package/local/chunks/context-request-event.Bl9Vpkzl.js +13 -0
  203. package/local/chunks/create-context.DS1OG3vJ.js +11 -0
  204. package/local/chunks/delegate.baxDQosr.js +63 -0
  205. package/local/chunks/directive.kLG6oqUu.js +27 -0
  206. package/local/chunks/dom.C98AFbJh.js +22 -0
  207. package/local/chunks/fileUpload.module.kN6o64aL.js +4 -0
  208. package/local/chunks/globals.Bz4SVF2g.js +4 -0
  209. package/local/chunks/helpers.BWcXAteC.js +53 -0
  210. package/local/chunks/index.Bz1Jq4c2.js +106 -0
  211. package/local/chunks/list.module.CZRPBLzy.js +4 -0
  212. package/local/chunks/lit-element.CJtt9wj5.js +557 -0
  213. package/local/chunks/provide.i2FlUkOu.js +110 -0
  214. package/local/chunks/query-assigned-elements.Drkgpk9q.js +19 -0
  215. package/local/chunks/query-assigned-nodes.Dgvsf6BR.js +19 -0
  216. package/local/chunks/query.lbpOn5CD.js +20 -0
  217. package/local/chunks/ref.B7e1Hu4F.js +107 -0
  218. package/local/chunks/register-custom-element.vod7zfGv.js +51 -0
  219. package/local/chunks/segmentedControl.module.BPXEWodj.js +4 -0
  220. package/local/chunks/state.CqiuSzAl.js +12 -0
  221. package/local/chunks/tokens.CTW8Tt94.js +9 -0
  222. package/local/chunks/unsafe-html.BzhXEygn.js +27 -0
  223. package/local/chunks/unsafe-svg.HSGf1NCU.js +14 -0
  224. package/local/wip/Checkbox/Checkbox.js +102 -0
  225. package/local/wip/Checkbox/CheckboxGroup/CheckboxGroup.js +27 -0
  226. package/local/wip/Checkbox/index.js +6 -0
  227. package/local/wip/FileUpload/FileUpload.Button.js +75 -0
  228. package/local/wip/FileUpload/FileUpload.Dropzone.js +149 -0
  229. package/local/wip/FileUpload/FileUpload.List.Item.js +201 -0
  230. package/local/wip/FileUpload/FileUpload.List.js +105 -0
  231. package/local/wip/FileUpload/FileUpload.js +452 -0
  232. package/local/wip/FileUpload/FileUploadContext.js +8 -0
  233. package/local/wip/FileUpload/FileUploadListContext.js +8 -0
  234. package/local/wip/FileUpload/index.js +13 -0
  235. package/local/wip/Form/Form.context.js +20 -0
  236. package/local/wip/Form/Form.decorator.js +145 -0
  237. package/local/wip/Form/Form.js +288 -0
  238. package/local/wip/Form/Form.utils.js +8 -0
  239. package/local/wip/Form/index.js +7 -0
  240. package/local/wip/Label/Label.js +86 -0
  241. package/local/wip/Label/index.js +4 -0
  242. package/local/wip/NativeSelect/NativeSelect.js +162 -0
  243. package/local/wip/NativeSelect/index.js +4 -0
  244. package/local/wip/RadioButton/RadioButton.js +123 -0
  245. package/local/wip/RadioButton/RadioButtonGroup/RadioButtonGroup.js +96 -0
  246. package/local/wip/RadioButton/index.js +6 -0
  247. package/local/wip/Switch/Switch.js +153 -0
  248. package/local/wip/Switch/SwitchGroup/SwitchGroup.js +15 -0
  249. package/local/wip/Switch/index.js +6 -0
  250. package/local/wip/TextArea/TextArea.js +192 -0
  251. package/local/wip/TextArea/index.js +4 -0
  252. package/local/wip/TextField/TextField.js +169 -0
  253. package/local/wip/TextField/index.js +4 -0
  254. package/package.json +78 -0
  255. package/vscode.css-custom-data.json +6 -0
  256. package/vscode.html-custom-data.json +2704 -0
  257. package/wip/Checkbox/Checkbox.d.ts +55 -0
  258. package/wip/Checkbox/Checkbox.js +104 -0
  259. package/wip/Checkbox/CheckboxGroup/CheckboxGroup.d.ts +11 -0
  260. package/wip/Checkbox/CheckboxGroup/CheckboxGroup.js +27 -0
  261. package/wip/Checkbox/index.d.ts +3 -0
  262. package/wip/Checkbox/index.js +6 -0
  263. package/wip/FileUpload/FileUpload.Button.d.ts +36 -0
  264. package/wip/FileUpload/FileUpload.Button.js +77 -0
  265. package/wip/FileUpload/FileUpload.Dropzone.d.ts +55 -0
  266. package/wip/FileUpload/FileUpload.Dropzone.js +150 -0
  267. package/wip/FileUpload/FileUpload.List.Item.d.ts +62 -0
  268. package/wip/FileUpload/FileUpload.List.Item.js +203 -0
  269. package/wip/FileUpload/FileUpload.List.d.ts +46 -0
  270. package/wip/FileUpload/FileUpload.List.js +106 -0
  271. package/wip/FileUpload/FileUpload.d.ts +101 -0
  272. package/wip/FileUpload/FileUpload.js +451 -0
  273. package/wip/FileUpload/FileUploadContext.d.ts +5 -0
  274. package/wip/FileUpload/FileUploadContext.js +8 -0
  275. package/wip/FileUpload/FileUploadListContext.d.ts +5 -0
  276. package/wip/FileUpload/FileUploadListContext.js +8 -0
  277. package/wip/FileUpload/index.d.ts +6 -0
  278. package/wip/FileUpload/index.js +13 -0
  279. package/wip/Form/Form.context.d.ts +19 -0
  280. package/wip/Form/Form.context.js +20 -0
  281. package/wip/Form/Form.d.ts +50 -0
  282. package/wip/Form/Form.decorator.d.ts +47 -0
  283. package/wip/Form/Form.decorator.js +144 -0
  284. package/wip/Form/Form.js +288 -0
  285. package/wip/Form/Form.utils.d.ts +2 -0
  286. package/wip/Form/Form.utils.js +8 -0
  287. package/wip/Form/index.d.ts +3 -0
  288. package/wip/Form/index.js +7 -0
  289. package/wip/Label/Label.d.ts +43 -0
  290. package/wip/Label/Label.js +87 -0
  291. package/wip/Label/index.d.ts +2 -0
  292. package/wip/Label/index.js +4 -0
  293. package/wip/NativeSelect/NativeSelect.d.ts +69 -0
  294. package/wip/NativeSelect/NativeSelect.js +163 -0
  295. package/wip/NativeSelect/index.d.ts +2 -0
  296. package/wip/NativeSelect/index.js +4 -0
  297. package/wip/RadioButton/RadioButton.d.ts +56 -0
  298. package/wip/RadioButton/RadioButton.js +125 -0
  299. package/wip/RadioButton/RadioButtonGroup/RadioButtonGroup.d.ts +23 -0
  300. package/wip/RadioButton/RadioButtonGroup/RadioButtonGroup.js +96 -0
  301. package/wip/RadioButton/index.d.ts +3 -0
  302. package/wip/RadioButton/index.js +6 -0
  303. package/wip/Switch/Switch.d.ts +62 -0
  304. package/wip/Switch/Switch.js +155 -0
  305. package/wip/Switch/SwitchGroup/SwitchGroup.d.ts +15 -0
  306. package/wip/Switch/SwitchGroup/SwitchGroup.js +15 -0
  307. package/wip/Switch/index.d.ts +3 -0
  308. package/wip/Switch/index.js +6 -0
  309. package/wip/TextArea/TextArea.d.ts +89 -0
  310. package/wip/TextArea/TextArea.js +193 -0
  311. package/wip/TextArea/index.d.ts +2 -0
  312. package/wip/TextArea/index.js +4 -0
  313. package/wip/TextField/TextField.d.ts +70 -0
  314. package/wip/TextField/TextField.js +169 -0
  315. package/wip/TextField/index.d.ts +2 -0
  316. package/wip/TextField/index.js +4 -0
@@ -0,0 +1,451 @@
1
+ import { consume as G, provide as K } from "@lit/context";
2
+ import { unsafeCSS as J, nothing as b, html as y } from "lit";
3
+ import { property as c, queryAssignedElements as N, state as P } from "lit/decorators.js";
4
+ import { createRef as Q } from "lit/directives/ref.js";
5
+ import X from "clsx";
6
+ import { t as Y } from "../../chunks/constants.jOWREYQE.js";
7
+ import { p as Z, a as q, g as ee, d as z } from "../../chunks/classNames.Cq_tbDRp.js";
8
+ import { f as te } from "../../chunks/fileUpload.module.kN6o64aL.js";
9
+ import { d as ie } from "../../chunks/tokens.CTW8Tt94.js";
10
+ import { r as re } from "../../chunks/delegate.baxDQosr.js";
11
+ import { c as se } from "../../chunks/register-custom-element.DHGKOhmA.js";
12
+ import { bmFormContext as oe, bmFormInitials as H } from "../Form/Form.context.js";
13
+ import { FormField as ae } from "../Form/Form.decorator.js";
14
+ import { fileUploadContext as le } from "./FileUploadContext.js";
15
+ import "../../chunks/HelperText.CcVVOtA3.js";
16
+ import "./FileUpload.Dropzone.js";
17
+ import "./FileUpload.List.js";
18
+ var ne = function(e, t) {
19
+ if (e && t) {
20
+ var i = Array.isArray(t) ? t : t.split(",");
21
+ if (i.length === 0)
22
+ return !0;
23
+ var r = e.name || "", s = (e.type || "").toLowerCase(), n = s.replace(/\/.*$/, "");
24
+ return i.some(function(p) {
25
+ var d = p.trim().toLowerCase();
26
+ return d.charAt(0) === "." ? r.toLowerCase().endsWith(d) : d.endsWith("/*") ? n === d.replace(/\/.*$/, "") : s === d;
27
+ });
28
+ }
29
+ return !0;
30
+ };
31
+ const de = (e, t) => {
32
+ const i = new FormData();
33
+ return t.files.forEach((r, s) => {
34
+ t.shouldAddToFormData[s] && i.append(e, r);
35
+ }), i;
36
+ }, he = {
37
+ fileItems: [],
38
+ abortControllers: [],
39
+ files: [],
40
+ shouldAddToFormData: [],
41
+ validFileCount: 0
42
+ };
43
+ function pe(e) {
44
+ return e < 6 ? `${e} B` : e < 1048576 / 2 ? `${(e / 1024).toFixed(2)} KB` : e < 1073741824 / 2 ? `${(e / 1048576).toFixed(2)} MB` : e < 1099511627776 / 2 ? `${(e / 1073741824).toFixed(2)} GB` : `${(e / 1099511627776 / 2).toFixed(2)} TB`;
45
+ }
46
+ const ce = (e, t, { accept: i, fileLimit: r, maxFileSize: s }) => {
47
+ if (i && !ne(e, i))
48
+ return "Incorrect file type";
49
+ if (r && t >= r)
50
+ return "Attachment limit reached";
51
+ if (s && e.size > s)
52
+ return "File size exceeds limit";
53
+ }, me = (e, {
54
+ state: t,
55
+ error: i
56
+ }) => ({
57
+ id: URL.createObjectURL(e),
58
+ fileName: e.name,
59
+ fileSize: pe(e.size),
60
+ state: t ?? "uploaded",
61
+ progress: 0,
62
+ error: i
63
+ }), ue = (e, t) => {
64
+ const i = new Image();
65
+ i.src = URL.createObjectURL(e), i.onload = () => {
66
+ const r = document.createElement("canvas"), s = r.getContext("2d");
67
+ s && (r.width = i.width, r.height = i.height, s.drawImage(i, 0, 0), t(r.toDataURL("image/jpeg")));
68
+ };
69
+ }, fe = (e) => URL.createObjectURL(e), ye = (e, t) => {
70
+ const i = document.createElement("video"), r = document.createElement("source"), s = document.createElement("canvas"), n = s.getContext("2d");
71
+ if (!n)
72
+ return;
73
+ i.crossOrigin = "anonymous", i.preload = "metadata", i.appendChild(r), r.src = URL.createObjectURL(e), i.currentTime = 0, i.load(), i.addEventListener("loadedmetadata", () => {
74
+ s.width = i.videoWidth, s.height = i.videoHeight;
75
+ });
76
+ const p = () => {
77
+ n.drawImage(i, 0, 0, s.width, s.height), t(s.toDataURL("image/jpeg"));
78
+ };
79
+ if (typeof i.requestVideoFrameCallback < "u")
80
+ i.requestVideoFrameCallback(p);
81
+ else {
82
+ const d = () => {
83
+ setTimeout(p, 0), i.removeEventListener("seeked", d);
84
+ };
85
+ i.addEventListener("seeked", d);
86
+ }
87
+ }, ve = (e, t) => {
88
+ if (e.type === "image/gif")
89
+ return ue(e, t);
90
+ if (e.type.startsWith("image/"))
91
+ return fe(e);
92
+ if (e.type.startsWith("video/"))
93
+ return ye(e, t);
94
+ };
95
+ function xe(e, t) {
96
+ t({ type: "remove", payload: e });
97
+ }
98
+ function Fe(e, t, i, r, s, n, p, d) {
99
+ if (!e)
100
+ return;
101
+ let f = i;
102
+ const k = Array.from(e).map((v) => {
103
+ const C = ce(v, f, {
104
+ accept: r,
105
+ fileLimit: s,
106
+ maxFileSize: n
107
+ }), m = me(v, {
108
+ error: C,
109
+ state: C ? "error" : p
110
+ }), V = new AbortController();
111
+ m.thumbnail = ve(v, (x) => {
112
+ t({
113
+ type: "update",
114
+ payload: { fileItem: m, updates: { thumbnail: x } }
115
+ });
116
+ });
117
+ let $ = !C;
118
+ return C || (f++, d ? $ = (d == null ? void 0 : d(
119
+ v,
120
+ {
121
+ progress(x) {
122
+ t({
123
+ type: "update",
124
+ payload: { fileItem: m, updates: { state: "uploading", progress: x } }
125
+ });
126
+ },
127
+ success() {
128
+ t({
129
+ type: "update",
130
+ payload: { fileItem: m, updates: { state: "success" } }
131
+ }), setTimeout(() => {
132
+ t({
133
+ type: "update",
134
+ payload: { fileItem: m, updates: { state: "uploaded" } }
135
+ });
136
+ }, 3e3);
137
+ },
138
+ error(x) {
139
+ t({
140
+ type: "update",
141
+ payload: { fileItem: m, updates: { state: "error", error: x } }
142
+ });
143
+ },
144
+ dismiss() {
145
+ t({ type: "remove", payload: m });
146
+ }
147
+ },
148
+ V.signal
149
+ )) ?? !1 : $ = !0), { file: v, fileItem: m, abortController: V, shouldAddToFormData: $ };
150
+ });
151
+ t({ type: "add", payload: k });
152
+ }
153
+ function Ce(e, t) {
154
+ var i;
155
+ switch (t.type) {
156
+ case "add":
157
+ return {
158
+ fileItems: [
159
+ ...e.fileItems,
160
+ ...t.payload.map(({ fileItem: r }) => r)
161
+ ],
162
+ abortControllers: [
163
+ ...e.abortControllers,
164
+ ...t.payload.map(({ abortController: r }) => r)
165
+ ],
166
+ files: [...e.files, ...t.payload.map(({ file: r }) => r)],
167
+ shouldAddToFormData: [
168
+ ...e.shouldAddToFormData,
169
+ ...t.payload.map(({ shouldAddToFormData: r }) => r)
170
+ ],
171
+ validFileCount: t.payload.reduce(
172
+ (r, { fileItem: s }) => s.state !== "error" ? r + 1 : r,
173
+ e.validFileCount
174
+ )
175
+ };
176
+ case "remove": {
177
+ const { payload: r } = t, s = e.fileItems.findIndex((n) => n.id === r.id);
178
+ return s < 0 ? e : ((i = e.abortControllers[s]) == null || i.abort(), {
179
+ fileItems: [
180
+ ...e.fileItems.slice(0, s),
181
+ ...e.fileItems.slice(s + 1)
182
+ ],
183
+ abortControllers: [
184
+ ...e.abortControllers.slice(0, s),
185
+ ...e.abortControllers.slice(s + 1)
186
+ ],
187
+ files: [...e.files.slice(0, s), ...e.files.slice(s + 1)],
188
+ shouldAddToFormData: [
189
+ ...e.shouldAddToFormData.slice(0, s),
190
+ ...e.shouldAddToFormData.slice(s + 1)
191
+ ],
192
+ validFileCount: e.validFileCount - (r.state !== "error" ? 1 : 0)
193
+ });
194
+ }
195
+ case "update": {
196
+ const { fileItem: r, updates: s } = t.payload, n = e.fileItems.findIndex((k) => k.id === r.id);
197
+ if (n < 0)
198
+ return e;
199
+ const p = e.fileItems[n].state, d = s.state ?? p;
200
+ let f = e.validFileCount;
201
+ return p !== "error" && d === "error" && (f -= 1), p === "error" && d !== "error" && (f += 1), {
202
+ ...e,
203
+ fileItems: [
204
+ ...e.fileItems.slice(0, n),
205
+ { ...e.fileItems[n], ...s },
206
+ ...e.fileItems.slice(n + 1)
207
+ ],
208
+ validFileCount: f
209
+ };
210
+ }
211
+ default:
212
+ return e;
213
+ }
214
+ }
215
+ var be = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, j = (e) => {
216
+ throw TypeError(e);
217
+ }, l = (e, t, i, r) => {
218
+ for (var s = r > 1 ? void 0 : r ? ge(t, i) : t, n = e.length - 1, p; n >= 0; n--)
219
+ (p = e[n]) && (s = (r ? p(t, i, s) : p(s)) || s);
220
+ return r && s && be(t, i, s), s;
221
+ }, we = (e, t, i) => t.has(e) || j("Cannot " + i), o = (e, t, i) => (we(e, t, "read from private field"), i ? i.call(e) : t.get(e)), h = (e, t, i) => t.has(e) ? j("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), u, L, A, S, T, W, E, _, I, F, M, R, D, B, U, O;
222
+ const { baseClassNamePrefix: Se, classModifierPrefix: g, subElementClassPrefix: w } = ee("file-upload");
223
+ class _e extends CustomEvent {
224
+ constructor(t, i, r) {
225
+ super("bm-selected", {
226
+ detail: { file: t, actions: i, abortSignal: r },
227
+ cancelable: !0,
228
+ bubbles: !0,
229
+ composed: !0
230
+ });
231
+ }
232
+ }
233
+ let a = class extends ae {
234
+ constructor() {
235
+ super(...arguments), this.disabled = !1, this.validationRules = [], this.fileUploadContext = {}, this.pickerRef = Q(), h(this, u, () => {
236
+ var e;
237
+ return !!(this.disabled || (e = this.formContext) != null && e.disabled);
238
+ }), h(this, L, () => {
239
+ var e;
240
+ return !!(this.readOnly || (e = this.formContext) != null && e.readOnly);
241
+ }), h(this, A, () => {
242
+ var e;
243
+ return !!(this.required || (e = this.formContext) != null && e.required);
244
+ }), this.filesState = he, h(this, S, (e) => {
245
+ this.filesState = Ce(this.filesState, e), this.fileUploadContext = {
246
+ ...this.fileUploadContext,
247
+ ctxFileItems: this.filesState.fileItems
248
+ }, this.setAssociatedValue(o(this, I).call(this));
249
+ }), h(this, T, (e, t, i) => {
250
+ const r = new _e(e, t, i);
251
+ return this.dispatchEvent(r);
252
+ }), h(this, W, (e) => {
253
+ Fe(
254
+ e,
255
+ o(this, S),
256
+ this.filesState.validFileCount,
257
+ this.accept,
258
+ this.fileLimit,
259
+ this.maxFileSize,
260
+ "uploaded",
261
+ o(this, T)
262
+ );
263
+ }), h(this, E, (e) => {
264
+ xe(e, o(this, S));
265
+ }), h(this, _, new CSSStyleSheet()), h(this, I, () => de(this.name, this.filesState)), h(this, F, () => {
266
+ const { initialValues: e } = this.formContext || H, { [this.name]: t } = e || {};
267
+ this.setAssociatedValue(
268
+ t instanceof FormData ? t : new FormData()
269
+ );
270
+ }), h(this, M, () => {
271
+ var e;
272
+ (e = this.pickerRef.value) == null || e.focus();
273
+ }), h(this, R, (e) => this.error ? y`
274
+ <bm-helper-text
275
+ id="${e}"
276
+ text="${this.error}"
277
+ appearance="negative"
278
+ .disabled="${o(this, u).call(this)}"
279
+ class="${w}helper-text"
280
+ ></bm-helper-text>
281
+ ` : b), this._hasPickerSlot = !1, h(this, D, () => !!this._hasPickerSlot), h(this, B, () => y`
282
+ <slot name="picker" @slotchange=${(t) => {
283
+ this._hasPickerSlot = z(t);
284
+ }}></slot>
285
+ ${o(this, D).call(this) ? b : y`<bm-file-upload-dropzone></bm-file-upload-dropzone>`}
286
+ `), this._hasFilesListSlot = !1, h(this, U, () => !!this._hasFilesListSlot), h(this, O, () => y`
287
+ <div class="${w}files-list">
288
+ <slot name="files-list" @slotchange=${(t) => {
289
+ this._hasFilesListSlot = z(t);
290
+ }}></slot>
291
+ ${o(this, U).call(this) ? b : y`<bm-file-upload-list thumbnail="false"></bm-file-upload-list>`}
292
+ </div>
293
+ `);
294
+ }
295
+ willUpdate() {
296
+ this.fileUploadContext = {
297
+ ctxAccept: this.accept,
298
+ ctxMultiple: this.multiple,
299
+ ctxFileLimit: this.fileLimit,
300
+ ctxMaxFileSize: this.maxFileSize,
301
+ ctxFileItems: this.filesState.fileItems,
302
+ ctxAddFiles: o(this, W),
303
+ ctxDismissFile: o(this, E),
304
+ ctxError: !!this.error,
305
+ ctxDisabled: o(this, u).call(this)
306
+ };
307
+ const e = this.fluid ? "100%" : this.width ?? ie;
308
+ o(this, _).replace(`:host { width: ${e}; }`);
309
+ }
310
+ firstUpdated() {
311
+ var i, r;
312
+ (r = (i = this.shadowRoot) == null ? void 0 : i.adoptedStyleSheets) == null || r.push(o(this, _));
313
+ const { value: e } = this.pickerRef, { registerField: t } = this.formContext || H;
314
+ !e || o(this, u).call(this) || t({
315
+ validators: this.validationRules,
316
+ initializer: o(this, F),
317
+ field: e,
318
+ errorSetter: this.setValidationErrors.bind(this)
319
+ });
320
+ }
321
+ updated(e) {
322
+ const [t] = this._textFieldLabel, [i] = this._textFieldHelperText, { decorate: r } = q(t), { decorate: s } = q(i);
323
+ Z(e, ["formContext"]) && this.ctxValueChanged(this.formContext, this.pickerRef) && o(this, F).call(this), s({ disabled: o(this, u).call(this) }), r({
324
+ disabled: o(this, u).call(this),
325
+ required: o(this, A).call(this) && !this.hideRequiredMarker
326
+ });
327
+ }
328
+ formAssociatedCallback() {
329
+ this.setAssociatedValue(o(this, I).call(this));
330
+ }
331
+ formResetCallback() {
332
+ o(this, F).call(this);
333
+ }
334
+ render() {
335
+ const { length: e } = this.validationErrors(), t = !!this.error || !!e, i = X(
336
+ Se,
337
+ t && `${g}error`,
338
+ this.theme && Y(this.theme),
339
+ this.fluid && `${g}fluid`,
340
+ o(this, u).call(this) && `${g}disabled`,
341
+ o(this, L).call(this) && `${g}read-only`
342
+ );
343
+ return y`
344
+ <div class=${i} style="max-width: ${this.width ?? b}">
345
+ <div class="${w}uploader">
346
+ <slot
347
+ name="label"
348
+ id=${this.labelId}
349
+ @bm-label-clicked=${o(this, M)}
350
+ ></slot>
351
+ <div class="${w}field">${o(this, B).call(this)}</div>
352
+ <slot name="helper-text" id="${this.helperTextId}"></slot>
353
+ ${o(this, R).call(this, this.errorId)} ${this.renderValidationErrors()}
354
+ </div>
355
+
356
+ ${o(this, O).call(this)}
357
+ </div>
358
+ `;
359
+ }
360
+ };
361
+ u = /* @__PURE__ */ new WeakMap();
362
+ L = /* @__PURE__ */ new WeakMap();
363
+ A = /* @__PURE__ */ new WeakMap();
364
+ S = /* @__PURE__ */ new WeakMap();
365
+ T = /* @__PURE__ */ new WeakMap();
366
+ W = /* @__PURE__ */ new WeakMap();
367
+ E = /* @__PURE__ */ new WeakMap();
368
+ _ = /* @__PURE__ */ new WeakMap();
369
+ I = /* @__PURE__ */ new WeakMap();
370
+ F = /* @__PURE__ */ new WeakMap();
371
+ M = /* @__PURE__ */ new WeakMap();
372
+ R = /* @__PURE__ */ new WeakMap();
373
+ D = /* @__PURE__ */ new WeakMap();
374
+ B = /* @__PURE__ */ new WeakMap();
375
+ U = /* @__PURE__ */ new WeakMap();
376
+ O = /* @__PURE__ */ new WeakMap();
377
+ a.styles = J(te);
378
+ re(a);
379
+ l([
380
+ c({ type: String })
381
+ ], a.prototype, "accept", 2);
382
+ l([
383
+ c({
384
+ type: String,
385
+ converter(e) {
386
+ return e === "true" ? !0 : e === "false" ? !1 : e;
387
+ }
388
+ })
389
+ ], a.prototype, "error", 2);
390
+ l([
391
+ c({ type: Boolean })
392
+ ], a.prototype, "disabled", 2);
393
+ l([
394
+ c({ type: Boolean })
395
+ ], a.prototype, "multiple", 2);
396
+ l([
397
+ c({ type: Number })
398
+ ], a.prototype, "fileLimit", 2);
399
+ l([
400
+ c({ type: Number })
401
+ ], a.prototype, "maxFileSize", 2);
402
+ l([
403
+ c({ type: Boolean })
404
+ ], a.prototype, "required", 2);
405
+ l([
406
+ c({ type: Boolean })
407
+ ], a.prototype, "readOnly", 2);
408
+ l([
409
+ c({ type: Boolean })
410
+ ], a.prototype, "hideRequiredMarker", 2);
411
+ l([
412
+ c({ type: Array })
413
+ ], a.prototype, "validationRules", 2);
414
+ l([
415
+ c({ type: Boolean })
416
+ ], a.prototype, "fluid", 2);
417
+ l([
418
+ c({ type: String })
419
+ ], a.prototype, "width", 2);
420
+ l([
421
+ c({ type: String })
422
+ ], a.prototype, "theme", 2);
423
+ l([
424
+ G({ context: oe, subscribe: !0 }),
425
+ c({ attribute: !1 })
426
+ ], a.prototype, "formContext", 2);
427
+ l([
428
+ K({ context: le })
429
+ ], a.prototype, "fileUploadContext", 2);
430
+ l([
431
+ N({ slot: "label" })
432
+ ], a.prototype, "_textFieldLabel", 2);
433
+ l([
434
+ N({ slot: "helper-text" })
435
+ ], a.prototype, "_textFieldHelperText", 2);
436
+ l([
437
+ P()
438
+ ], a.prototype, "filesState", 2);
439
+ l([
440
+ P()
441
+ ], a.prototype, "_hasPickerSlot", 2);
442
+ l([
443
+ P()
444
+ ], a.prototype, "_hasFilesListSlot", 2);
445
+ a = l([
446
+ se("bm-file-upload")
447
+ ], a);
448
+ export {
449
+ a as BmFileUpload,
450
+ _e as BmFileUploadFileSelectedEvent
451
+ };
@@ -0,0 +1,5 @@
1
+ import { FileUploadContextValue } from '@viasat/beam-shared/components/fileUpload';
2
+ export declare const fileUploadContext: {
3
+ __context__: FileUploadContextValue;
4
+ };
5
+ //# sourceMappingURL=FileUploadContext.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { createContext as o } from "@lit/context";
2
+ import { p as t } from "../../chunks/constants.jOWREYQE.js";
3
+ const m = o(
4
+ Symbol(`${t}form-context`)
5
+ );
6
+ export {
7
+ m as fileUploadContext
8
+ };
@@ -0,0 +1,5 @@
1
+ import { FileUploadListContextValue } from '@viasat/beam-shared/components/fileUpload';
2
+ export declare const fileUploadListContext: {
3
+ __context__: FileUploadListContextValue;
4
+ };
5
+ //# sourceMappingURL=FileUploadListContext.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { createContext as t } from "@lit/context";
2
+ import { p as o } from "../../chunks/constants.jOWREYQE.js";
3
+ const i = t(
4
+ Symbol(`${o}form-list-context`)
5
+ );
6
+ export {
7
+ i as fileUploadListContext
8
+ };
@@ -0,0 +1,6 @@
1
+ export * from './FileUpload';
2
+ export * from './FileUpload.Button';
3
+ export * from './FileUpload.Dropzone';
4
+ export * from './FileUpload.List';
5
+ export * from './FileUpload.List.Item';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { BmFileUpload as l, BmFileUploadFileSelectedEvent as m } from "./FileUpload.js";
2
+ import { BmFileUploadButton as t } from "./FileUpload.Button.js";
3
+ import { BmFileUploadDropzone as i } from "./FileUpload.Dropzone.js";
4
+ import { BmFileUploadList as B } from "./FileUpload.List.js";
5
+ import { BmFileUploadListItem as a } from "./FileUpload.List.Item.js";
6
+ export {
7
+ l as BmFileUpload,
8
+ t as BmFileUploadButton,
9
+ i as BmFileUploadDropzone,
10
+ m as BmFileUploadFileSelectedEvent,
11
+ B as BmFileUploadList,
12
+ a as BmFileUploadListItem
13
+ };
@@ -0,0 +1,19 @@
1
+ import { FormValue, FieldMeta } from '@viasat/beam-shared/components/form';
2
+ export interface BmFormContextStates {
3
+ required: boolean;
4
+ disabled: boolean;
5
+ readOnly: boolean;
6
+ }
7
+ export interface BmFormContextHandlers {
8
+ formChangeHandler: (event: Event) => void;
9
+ formBlurHandler: (event: FocusEvent) => void;
10
+ }
11
+ export interface BmFormContext extends BmFormContextStates, BmFormContextHandlers {
12
+ initialValues: Record<string, FormValue>;
13
+ registerField: (metaData: FieldMeta) => void;
14
+ }
15
+ export declare const bmFormInitials: BmFormContext;
16
+ export declare const bmFormContext: {
17
+ __context__: BmFormContext;
18
+ };
19
+ //# sourceMappingURL=Form.context.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { createContext as e } from "@lit/context";
2
+ import { p as r } from "../../chunks/constants.jOWREYQE.js";
3
+ const t = {
4
+ required: !1,
5
+ disabled: !1,
6
+ readOnly: !1,
7
+ initialValues: {},
8
+ registerField: () => {
9
+ },
10
+ formBlurHandler: () => {
11
+ },
12
+ formChangeHandler: () => {
13
+ }
14
+ }, a = e(
15
+ Symbol(`${r}form-context`)
16
+ );
17
+ export {
18
+ a as bmFormContext,
19
+ t as bmFormInitials
20
+ };
@@ -0,0 +1,50 @@
1
+ import { LitElement } from 'lit';
2
+ import { FormValue, FieldMeta, ValidationMode } from '@viasat/beam-shared/components/form';
3
+ import { Optional } from '@viasat/beam-shared/utils/types';
4
+ import { BmFormContext } from './Form.context';
5
+ export { validators } from '@viasat/beam-shared/components/form';
6
+ /**
7
+ * @summary `bm-form`
8
+ *
9
+ * @slot slot - Add controls to the Form
10
+ * @fires submit - Validates the inputs and submits the form
11
+ */
12
+ export declare class BmForm extends LitElement {
13
+ #private;
14
+ /**
15
+ * Specify if validation runs on change or when loosing focus
16
+ */
17
+ validationMode: ValidationMode;
18
+ /**
19
+ * Specify initial values on Form controls based on their names
20
+ */
21
+ initialValues: Record<string, FormValue>;
22
+ /**
23
+ * Specify if input is a required
24
+ */
25
+ required: boolean;
26
+ /**
27
+ * Specify if input is a disabled
28
+ */
29
+ disabled: boolean;
30
+ /**
31
+ * Specify if input is a read only
32
+ */
33
+ readOnly: boolean;
34
+ action: Optional<string>;
35
+ method: Optional<string>;
36
+ target: Optional<string>;
37
+ enctype: Optional<string>;
38
+ formMeta: Record<string, FieldMeta>;
39
+ formRef: import('lit-html/directives/ref').Ref<HTMLFormElement>;
40
+ private _actionFired;
41
+ formContext: BmFormContext;
42
+ willUpdate(changedProperties: Map<string, unknown>): void;
43
+ render(): import('lit-html').TemplateResult<1>;
44
+ }
45
+ declare global {
46
+ interface HTMLElementTagNameMap {
47
+ 'bm-form': BmForm;
48
+ }
49
+ }
50
+ //# sourceMappingURL=Form.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { nothing, LitElement } from 'lit';
2
+ import { Ref } from 'lit/directives/ref.js';
3
+ import { FormValidator, FormValue } from '@viasat/beam-shared/components/form';
4
+ import { Optional } from '@viasat/beam-shared/utils/types';
5
+ import { FinalizeAssociatedResult } from '../../../utils/mixins/types';
6
+ import { BmFormContext } from '../Form/Form.context';
7
+ export declare class FormField extends LitElement {
8
+ #private;
9
+ static formAssociated: boolean;
10
+ protected labelId: string;
11
+ protected errorId: string;
12
+ protected helperTextId: string;
13
+ protected validationErrorsId: string;
14
+ protected internals: ElementInternals;
15
+ protected formFieldRef: Ref<Element>;
16
+ protected contextInitialValue: Optional<string>;
17
+ protected contextBrowserValue: Optional<string>;
18
+ id: string;
19
+ name: string;
20
+ value: string;
21
+ validationRules: Array<FormValidator>;
22
+ inputAriaLabel: Optional<string>;
23
+ formContext: BmFormContext;
24
+ private _validationErrors;
25
+ protected validationErrors: () => Array<Optional<string>>;
26
+ protected setAssociatedValue(value: FormValue): void;
27
+ protected requestAssociatedSubmit(): void;
28
+ protected setValidationErrors: (errors: Array<Optional<string>>) => void;
29
+ protected validationErrorShown: () => boolean;
30
+ connectedCallback(): void;
31
+ protected ctxValueChanged(ctx: BmFormContext, ref: Ref): boolean;
32
+ disconnectedCallback(): void;
33
+ formAssociatedCallback(): void;
34
+ formResetCallback(): void;
35
+ finalizeAssociatedCallback(ctxValue: string): FinalizeAssociatedResult;
36
+ protected submitFormByEnter: ({ key }: KeyboardEvent) => void;
37
+ protected forwardLabelFocus: () => void;
38
+ protected validateFieldOnBlur: (event: FocusEvent) => void;
39
+ protected validateFieldOnChange: (event: Event) => void;
40
+ protected getContextValue: () => string;
41
+ protected setContextValue: () => void;
42
+ protected setContextValidation: () => void;
43
+ protected contextInitialsChanged: () => boolean;
44
+ protected renderError: (error: Optional<string>, disabled: boolean) => typeof nothing | import('lit-html').TemplateResult<1>;
45
+ protected renderValidationErrors: () => typeof nothing | import('lit-html').TemplateResult<1>;
46
+ }
47
+ //# sourceMappingURL=Form.decorator.d.ts.map