@unofficialbox/box-open-elements 0.1.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 (351) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -0
  3. package/dist/components/actions/button-group.d.ts +22 -0
  4. package/dist/components/actions/button-group.js +255 -0
  5. package/dist/components/actions/button.d.ts +16 -0
  6. package/dist/components/actions/button.js +190 -0
  7. package/dist/components/actions/icon-button.d.ts +20 -0
  8. package/dist/components/actions/icon-button.js +187 -0
  9. package/dist/components/actions/link-button.d.ts +14 -0
  10. package/dist/components/actions/link-button.js +137 -0
  11. package/dist/components/actions/menu-item.d.ts +17 -0
  12. package/dist/components/actions/menu-item.js +137 -0
  13. package/dist/components/actions/menu.d.ts +22 -0
  14. package/dist/components/actions/menu.js +178 -0
  15. package/dist/components/actions/segmented-control.d.ts +27 -0
  16. package/dist/components/actions/segmented-control.js +273 -0
  17. package/dist/components/collections/card.d.ts +13 -0
  18. package/dist/components/collections/card.js +110 -0
  19. package/dist/components/collections/carousel.d.ts +40 -0
  20. package/dist/components/collections/carousel.js +406 -0
  21. package/dist/components/collections/datalist-item.d.ts +32 -0
  22. package/dist/components/collections/datalist-item.js +196 -0
  23. package/dist/components/collections/draggable-list.d.ts +33 -0
  24. package/dist/components/collections/draggable-list.js +306 -0
  25. package/dist/components/collections/grid-view.d.ts +38 -0
  26. package/dist/components/collections/grid-view.js +321 -0
  27. package/dist/components/collections/pagination.d.ts +19 -0
  28. package/dist/components/collections/pagination.js +147 -0
  29. package/dist/components/collections/tree-grid.d.ts +47 -0
  30. package/dist/components/collections/tree-grid.js +593 -0
  31. package/dist/components/collections/tree.d.ts +37 -0
  32. package/dist/components/collections/tree.js +526 -0
  33. package/dist/components/feedback/alert.d.ts +27 -0
  34. package/dist/components/feedback/alert.js +263 -0
  35. package/dist/components/feedback/badge.d.ts +12 -0
  36. package/dist/components/feedback/badge.js +99 -0
  37. package/dist/components/feedback/chip.d.ts +33 -0
  38. package/dist/components/feedback/chip.js +261 -0
  39. package/dist/components/feedback/empty-state.d.ts +19 -0
  40. package/dist/components/feedback/empty-state.js +137 -0
  41. package/dist/components/feedback/error-mask.d.ts +25 -0
  42. package/dist/components/feedback/error-mask.js +199 -0
  43. package/dist/components/feedback/help-text.d.ts +22 -0
  44. package/dist/components/feedback/help-text.js +176 -0
  45. package/dist/components/feedback/nudge.d.ts +32 -0
  46. package/dist/components/feedback/nudge.js +299 -0
  47. package/dist/components/feedback/progress-bar.d.ts +18 -0
  48. package/dist/components/feedback/progress-bar.js +128 -0
  49. package/dist/components/feedback/progress-ring.d.ts +21 -0
  50. package/dist/components/feedback/progress-ring.js +155 -0
  51. package/dist/components/feedback/progress-steps.d.ts +25 -0
  52. package/dist/components/feedback/progress-steps.js +276 -0
  53. package/dist/components/feedback/skeleton.d.ts +14 -0
  54. package/dist/components/feedback/skeleton.js +95 -0
  55. package/dist/components/feedback/spinner.d.ts +10 -0
  56. package/dist/components/feedback/spinner.js +80 -0
  57. package/dist/components/feedback/toast.d.ts +26 -0
  58. package/dist/components/feedback/toast.js +205 -0
  59. package/dist/components/files/drop-zone.d.ts +19 -0
  60. package/dist/components/files/drop-zone.js +169 -0
  61. package/dist/components/forms/calendar.d.ts +47 -0
  62. package/dist/components/forms/calendar.js +499 -0
  63. package/dist/components/forms/category-selector.d.ts +35 -0
  64. package/dist/components/forms/category-selector.js +269 -0
  65. package/dist/components/forms/checkbox-group.d.ts +31 -0
  66. package/dist/components/forms/checkbox-group.js +267 -0
  67. package/dist/components/forms/checkbox.d.ts +28 -0
  68. package/dist/components/forms/checkbox.js +250 -0
  69. package/dist/components/forms/color-picker.d.ts +34 -0
  70. package/dist/components/forms/color-picker.js +314 -0
  71. package/dist/components/forms/combobox.d.ts +37 -0
  72. package/dist/components/forms/combobox.js +234 -0
  73. package/dist/components/forms/date-field.d.ts +27 -0
  74. package/dist/components/forms/date-field.js +187 -0
  75. package/dist/components/forms/dropdown.d.ts +38 -0
  76. package/dist/components/forms/dropdown.js +405 -0
  77. package/dist/components/forms/dual-listbox.d.ts +44 -0
  78. package/dist/components/forms/dual-listbox.js +484 -0
  79. package/dist/components/forms/fieldset.d.ts +32 -0
  80. package/dist/components/forms/fieldset.js +168 -0
  81. package/dist/components/forms/multi-select.d.ts +30 -0
  82. package/dist/components/forms/multi-select.js +264 -0
  83. package/dist/components/forms/number-input.d.ts +32 -0
  84. package/dist/components/forms/number-input.js +245 -0
  85. package/dist/components/forms/pill-cloud.d.ts +35 -0
  86. package/dist/components/forms/pill-cloud.js +230 -0
  87. package/dist/components/forms/pill-selector-dropdown.d.ts +55 -0
  88. package/dist/components/forms/pill-selector-dropdown.js +499 -0
  89. package/dist/components/forms/radio-group.d.ts +32 -0
  90. package/dist/components/forms/radio-group.js +285 -0
  91. package/dist/components/forms/range-slider.d.ts +36 -0
  92. package/dist/components/forms/range-slider.js +294 -0
  93. package/dist/components/forms/rating.d.ts +31 -0
  94. package/dist/components/forms/rating.js +302 -0
  95. package/dist/components/forms/rich-text-input.d.ts +32 -0
  96. package/dist/components/forms/rich-text-input.js +403 -0
  97. package/dist/components/forms/search-field.d.ts +27 -0
  98. package/dist/components/forms/search-field.js +293 -0
  99. package/dist/components/forms/select.d.ts +30 -0
  100. package/dist/components/forms/select.js +198 -0
  101. package/dist/components/forms/slider.d.ts +31 -0
  102. package/dist/components/forms/slider.js +221 -0
  103. package/dist/components/forms/spin-button.d.ts +33 -0
  104. package/dist/components/forms/spin-button.js +352 -0
  105. package/dist/components/forms/switch.d.ts +32 -0
  106. package/dist/components/forms/switch.js +302 -0
  107. package/dist/components/forms/tag-input.d.ts +46 -0
  108. package/dist/components/forms/tag-input.js +420 -0
  109. package/dist/components/forms/text-area.d.ts +26 -0
  110. package/dist/components/forms/text-area.js +188 -0
  111. package/dist/components/forms/text-field.d.ts +24 -0
  112. package/dist/components/forms/text-field.js +151 -0
  113. package/dist/components/forms/time-field.d.ts +29 -0
  114. package/dist/components/forms/time-field.js +203 -0
  115. package/dist/components/identity/avatar.d.ts +21 -0
  116. package/dist/components/identity/avatar.js +191 -0
  117. package/dist/components/identity/contact-datalist-item.d.ts +31 -0
  118. package/dist/components/identity/contact-datalist-item.js +235 -0
  119. package/dist/components/identity/persona.d.ts +28 -0
  120. package/dist/components/identity/persona.js +272 -0
  121. package/dist/components/layout/app-shell.d.ts +26 -0
  122. package/dist/components/layout/app-shell.js +258 -0
  123. package/dist/components/layout/divider.d.ts +12 -0
  124. package/dist/components/layout/divider.js +119 -0
  125. package/dist/components/layout/nav-sidebar.d.ts +23 -0
  126. package/dist/components/layout/nav-sidebar.js +167 -0
  127. package/dist/components/layout/section.d.ts +20 -0
  128. package/dist/components/layout/section.js +143 -0
  129. package/dist/components/layout/sidebar-toggle-button.d.ts +26 -0
  130. package/dist/components/layout/sidebar-toggle-button.js +137 -0
  131. package/dist/components/layout/split-view.d.ts +19 -0
  132. package/dist/components/layout/split-view.js +157 -0
  133. package/dist/components/navigation/accordion.d.ts +25 -0
  134. package/dist/components/navigation/accordion.js +253 -0
  135. package/dist/components/navigation/tabs.d.ts +27 -0
  136. package/dist/components/navigation/tabs.js +289 -0
  137. package/dist/components/overlays/dialog.d.ts +26 -0
  138. package/dist/components/overlays/dialog.js +267 -0
  139. package/dist/components/overlays/drawer.d.ts +32 -0
  140. package/dist/components/overlays/drawer.js +323 -0
  141. package/dist/components/overlays/popover.d.ts +35 -0
  142. package/dist/components/overlays/popover.js +317 -0
  143. package/dist/components/overlays/tooltip.d.ts +26 -0
  144. package/dist/components/overlays/tooltip.js +204 -0
  145. package/dist/components/visuals/illustration.d.ts +26 -0
  146. package/dist/components/visuals/illustration.js +319 -0
  147. package/dist/core/controller.d.ts +11 -0
  148. package/dist/core/controller.js +23 -0
  149. package/dist/core/element.d.ts +22 -0
  150. package/dist/core/element.js +28 -0
  151. package/dist/core/event-emitter.d.ts +9 -0
  152. package/dist/core/event-emitter.js +33 -0
  153. package/dist/core/form-associated.d.ts +63 -0
  154. package/dist/core/form-associated.js +218 -0
  155. package/dist/core/index.d.ts +6 -0
  156. package/dist/core/index.js +4 -0
  157. package/dist/core/json-schema.d.ts +1 -0
  158. package/dist/core/json-schema.js +1 -0
  159. package/dist/foundations/a11y/focus.d.ts +17 -0
  160. package/dist/foundations/a11y/focus.js +94 -0
  161. package/dist/foundations/a11y/heading.d.ts +26 -0
  162. package/dist/foundations/a11y/heading.js +40 -0
  163. package/dist/foundations/a11y/index.d.ts +5 -0
  164. package/dist/foundations/a11y/index.js +3 -0
  165. package/dist/foundations/a11y/keyboard.d.ts +28 -0
  166. package/dist/foundations/a11y/keyboard.js +77 -0
  167. package/dist/foundations/geometry/index.d.ts +1 -0
  168. package/dist/foundations/geometry/index.js +1 -0
  169. package/dist/foundations/geometry/tokens.d.ts +123 -0
  170. package/dist/foundations/geometry/tokens.js +154 -0
  171. package/dist/foundations/icons/box-iconography.d.ts +479 -0
  172. package/dist/foundations/icons/box-iconography.generated.d.ts +2370 -0
  173. package/dist/foundations/icons/box-iconography.generated.js +4010 -0
  174. package/dist/foundations/icons/box-iconography.js +39 -0
  175. package/dist/foundations/icons/index.d.ts +1 -0
  176. package/dist/foundations/icons/index.js +1 -0
  177. package/dist/foundations/motion/index.d.ts +2 -0
  178. package/dist/foundations/motion/index.js +1 -0
  179. package/dist/foundations/motion/tokens.d.ts +39 -0
  180. package/dist/foundations/motion/tokens.js +43 -0
  181. package/dist/foundations/tokens/box-dark.d.ts +11 -0
  182. package/dist/foundations/tokens/box-dark.js +46 -0
  183. package/dist/foundations/tokens/box-defaults.d.ts +5 -0
  184. package/dist/foundations/tokens/box-defaults.js +52 -0
  185. package/dist/foundations/tokens/index.d.ts +5 -0
  186. package/dist/foundations/tokens/index.js +4 -0
  187. package/dist/foundations/tokens/interaction.d.ts +28 -0
  188. package/dist/foundations/tokens/interaction.js +72 -0
  189. package/dist/foundations/tokens/registry.d.ts +14 -0
  190. package/dist/foundations/tokens/registry.js +92 -0
  191. package/dist/foundations/tokens/types.d.ts +16 -0
  192. package/dist/foundations/tokens/types.js +1 -0
  193. package/dist/foundations/typography/index.d.ts +2 -0
  194. package/dist/foundations/typography/index.js +1 -0
  195. package/dist/foundations/typography/tokens.d.ts +76 -0
  196. package/dist/foundations/typography/tokens.js +27 -0
  197. package/dist/index.d.ts +87 -0
  198. package/dist/index.js +98 -0
  199. package/dist/patterns/content-explorer/actions/controller.d.ts +12 -0
  200. package/dist/patterns/content-explorer/actions/controller.js +36 -0
  201. package/dist/patterns/content-explorer/actions/index.d.ts +2 -0
  202. package/dist/patterns/content-explorer/actions/index.js +1 -0
  203. package/dist/patterns/content-explorer/actions/types.d.ts +13 -0
  204. package/dist/patterns/content-explorer/actions/types.js +1 -0
  205. package/dist/patterns/content-explorer/adapters/action-menu.d.ts +24 -0
  206. package/dist/patterns/content-explorer/adapters/action-menu.js +312 -0
  207. package/dist/patterns/content-explorer/adapters/breadcrumbs.d.ts +15 -0
  208. package/dist/patterns/content-explorer/adapters/breadcrumbs.js +161 -0
  209. package/dist/patterns/content-explorer/adapters/item-summary.d.ts +11 -0
  210. package/dist/patterns/content-explorer/adapters/item-summary.js +72 -0
  211. package/dist/patterns/content-explorer/adapters/items.d.ts +4 -0
  212. package/dist/patterns/content-explorer/adapters/items.js +12 -0
  213. package/dist/patterns/content-explorer/adapters/list.d.ts +28 -0
  214. package/dist/patterns/content-explorer/adapters/list.js +527 -0
  215. package/dist/patterns/content-explorer/adapters/table.d.ts +23 -0
  216. package/dist/patterns/content-explorer/adapters/table.js +467 -0
  217. package/dist/patterns/content-explorer/adapters/toolbar.d.ts +19 -0
  218. package/dist/patterns/content-explorer/adapters/toolbar.js +234 -0
  219. package/dist/patterns/content-explorer/box-transport.d.ts +44 -0
  220. package/dist/patterns/content-explorer/box-transport.js +229 -0
  221. package/dist/patterns/content-explorer/collection/controller.d.ts +17 -0
  222. package/dist/patterns/content-explorer/collection/controller.js +67 -0
  223. package/dist/patterns/content-explorer/collection/index.d.ts +2 -0
  224. package/dist/patterns/content-explorer/collection/index.js +1 -0
  225. package/dist/patterns/content-explorer/collection/types.d.ts +20 -0
  226. package/dist/patterns/content-explorer/collection/types.js +1 -0
  227. package/dist/patterns/content-explorer/content-explorer.d.ts +85 -0
  228. package/dist/patterns/content-explorer/content-explorer.js +745 -0
  229. package/dist/patterns/content-explorer/contracts.d.ts +32 -0
  230. package/dist/patterns/content-explorer/contracts.js +114 -0
  231. package/dist/patterns/content-explorer/controller.d.ts +34 -0
  232. package/dist/patterns/content-explorer/controller.js +399 -0
  233. package/dist/patterns/content-explorer/host-bindings.d.ts +50 -0
  234. package/dist/patterns/content-explorer/host-bindings.js +76 -0
  235. package/dist/patterns/content-explorer/index.d.ts +18 -0
  236. package/dist/patterns/content-explorer/index.js +24 -0
  237. package/dist/patterns/content-explorer/navigation/controller.d.ts +10 -0
  238. package/dist/patterns/content-explorer/navigation/controller.js +48 -0
  239. package/dist/patterns/content-explorer/navigation/index.d.ts +2 -0
  240. package/dist/patterns/content-explorer/navigation/index.js +1 -0
  241. package/dist/patterns/content-explorer/navigation/types.d.ts +20 -0
  242. package/dist/patterns/content-explorer/navigation/types.js +1 -0
  243. package/dist/patterns/content-explorer/schemas.d.ts +6 -0
  244. package/dist/patterns/content-explorer/schemas.js +120 -0
  245. package/dist/patterns/content-explorer/selection/controller.d.ts +12 -0
  246. package/dist/patterns/content-explorer/selection/controller.js +54 -0
  247. package/dist/patterns/content-explorer/selection/index.d.ts +2 -0
  248. package/dist/patterns/content-explorer/selection/index.js +1 -0
  249. package/dist/patterns/content-explorer/selection/types.d.ts +14 -0
  250. package/dist/patterns/content-explorer/selection/types.js +1 -0
  251. package/dist/patterns/content-explorer/types.d.ts +209 -0
  252. package/dist/patterns/content-explorer/types.js +10 -0
  253. package/dist/patterns/file-request/file-request-builder.d.ts +36 -0
  254. package/dist/patterns/file-request/file-request-builder.js +344 -0
  255. package/dist/patterns/file-request/index.d.ts +1 -0
  256. package/dist/patterns/file-request/index.js +1 -0
  257. package/dist/patterns/governance/governance-panel.d.ts +40 -0
  258. package/dist/patterns/governance/governance-panel.js +351 -0
  259. package/dist/patterns/governance/index.d.ts +1 -0
  260. package/dist/patterns/governance/index.js +1 -0
  261. package/dist/patterns/insights/bar-chart.d.ts +43 -0
  262. package/dist/patterns/insights/bar-chart.js +462 -0
  263. package/dist/patterns/insights/chart-panel.d.ts +43 -0
  264. package/dist/patterns/insights/chart-panel.js +436 -0
  265. package/dist/patterns/insights/donut-chart.d.ts +43 -0
  266. package/dist/patterns/insights/donut-chart.js +535 -0
  267. package/dist/patterns/insights/index.d.ts +5 -0
  268. package/dist/patterns/insights/index.js +5 -0
  269. package/dist/patterns/insights/line-chart.d.ts +46 -0
  270. package/dist/patterns/insights/line-chart.js +511 -0
  271. package/dist/patterns/insights/metric-card.d.ts +36 -0
  272. package/dist/patterns/insights/metric-card.js +278 -0
  273. package/dist/patterns/item/bulk-action-bar.d.ts +35 -0
  274. package/dist/patterns/item/bulk-action-bar.js +325 -0
  275. package/dist/patterns/item/index.d.ts +4 -0
  276. package/dist/patterns/item/index.js +4 -0
  277. package/dist/patterns/item/item-details-panel.d.ts +61 -0
  278. package/dist/patterns/item/item-details-panel.js +429 -0
  279. package/dist/patterns/item/item-form.d.ts +54 -0
  280. package/dist/patterns/item/item-form.js +485 -0
  281. package/dist/patterns/item/preview-header.d.ts +46 -0
  282. package/dist/patterns/item/preview-header.js +323 -0
  283. package/dist/patterns/metadata/contracts.d.ts +75 -0
  284. package/dist/patterns/metadata/contracts.js +91 -0
  285. package/dist/patterns/metadata/index.d.ts +4 -0
  286. package/dist/patterns/metadata/index.js +4 -0
  287. package/dist/patterns/metadata/metadata-filter-builder.d.ts +43 -0
  288. package/dist/patterns/metadata/metadata-filter-builder.js +362 -0
  289. package/dist/patterns/metadata/metadata-inspector.d.ts +31 -0
  290. package/dist/patterns/metadata/metadata-inspector.js +245 -0
  291. package/dist/patterns/metadata/schemas.d.ts +5 -0
  292. package/dist/patterns/metadata/schemas.js +66 -0
  293. package/dist/patterns/preview/annotation-inspector.d.ts +44 -0
  294. package/dist/patterns/preview/annotation-inspector.js +380 -0
  295. package/dist/patterns/preview/annotation-thread.d.ts +37 -0
  296. package/dist/patterns/preview/annotation-thread.js +338 -0
  297. package/dist/patterns/preview/annotation-toolbar.d.ts +42 -0
  298. package/dist/patterns/preview/annotation-toolbar.js +393 -0
  299. package/dist/patterns/preview/content-preview-adapter.d.ts +13 -0
  300. package/dist/patterns/preview/content-preview-adapter.js +30 -0
  301. package/dist/patterns/preview/index.d.ts +6 -0
  302. package/dist/patterns/preview/index.js +6 -0
  303. package/dist/patterns/preview/preview-element.d.ts +41 -0
  304. package/dist/patterns/preview/preview-element.js +429 -0
  305. package/dist/patterns/preview/provider-adapter.d.ts +36 -0
  306. package/dist/patterns/preview/provider-adapter.js +29 -0
  307. package/dist/patterns/search/filter-bar.d.ts +50 -0
  308. package/dist/patterns/search/filter-bar.js +379 -0
  309. package/dist/patterns/search/index.d.ts +3 -0
  310. package/dist/patterns/search/index.js +3 -0
  311. package/dist/patterns/search/saved-view-picker.d.ts +25 -0
  312. package/dist/patterns/search/saved-view-picker.js +239 -0
  313. package/dist/patterns/search/search-results-header.d.ts +34 -0
  314. package/dist/patterns/search/search-results-header.js +288 -0
  315. package/dist/patterns/share/access-stats.d.ts +19 -0
  316. package/dist/patterns/share/access-stats.js +204 -0
  317. package/dist/patterns/share/collaborator-avatars.d.ts +22 -0
  318. package/dist/patterns/share/collaborator-avatars.js +214 -0
  319. package/dist/patterns/share/contracts.d.ts +65 -0
  320. package/dist/patterns/share/contracts.js +75 -0
  321. package/dist/patterns/share/index.d.ts +14 -0
  322. package/dist/patterns/share/index.js +14 -0
  323. package/dist/patterns/share/invite-collaborators-contracts.d.ts +38 -0
  324. package/dist/patterns/share/invite-collaborators-contracts.js +1 -0
  325. package/dist/patterns/share/invite-collaborators-controller.d.ts +40 -0
  326. package/dist/patterns/share/invite-collaborators-controller.js +86 -0
  327. package/dist/patterns/share/invite-collaborators-modal.d.ts +46 -0
  328. package/dist/patterns/share/invite-collaborators-modal.js +465 -0
  329. package/dist/patterns/share/permission-matrix.d.ts +37 -0
  330. package/dist/patterns/share/permission-matrix.js +360 -0
  331. package/dist/patterns/share/presence-contracts.d.ts +26 -0
  332. package/dist/patterns/share/presence-contracts.js +1 -0
  333. package/dist/patterns/share/presence-controller.d.ts +31 -0
  334. package/dist/patterns/share/presence-controller.js +47 -0
  335. package/dist/patterns/share/presence.d.ts +32 -0
  336. package/dist/patterns/share/presence.js +255 -0
  337. package/dist/patterns/share/schemas.d.ts +4 -0
  338. package/dist/patterns/share/schemas.js +41 -0
  339. package/dist/patterns/share/share-panel.d.ts +75 -0
  340. package/dist/patterns/share/share-panel.js +565 -0
  341. package/dist/patterns/share/unified-share-controller.d.ts +52 -0
  342. package/dist/patterns/share/unified-share-controller.js +97 -0
  343. package/dist/patterns/share/unified-share-modal.d.ts +50 -0
  344. package/dist/patterns/share/unified-share-modal.js +646 -0
  345. package/dist/patterns/task/index.d.ts +2 -0
  346. package/dist/patterns/task/index.js +2 -0
  347. package/dist/patterns/task/review-queue-item.d.ts +45 -0
  348. package/dist/patterns/task/review-queue-item.js +403 -0
  349. package/dist/patterns/task/task-assignment-panel.d.ts +50 -0
  350. package/dist/patterns/task/task-assignment-panel.js +450 -0
  351. package/package.json +151 -0
@@ -0,0 +1,319 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ import { DESIGN_SYSTEM_CHANGE_EVENT, resolveDesignIllustration, } from "../../foundations/tokens/registry.js";
3
+ const DEFAULT_TAG_NAME = "box-illustration";
4
+ const illustrationStyles = `
5
+ :host {
6
+ display: block;
7
+ color: inherit;
8
+ font: inherit;
9
+ }
10
+
11
+ [part="illustration"] {
12
+ display: grid;
13
+ gap: 0.55rem;
14
+ justify-items: center;
15
+ margin: 0;
16
+ text-align: center;
17
+ }
18
+
19
+ [part="art"] {
20
+ position: relative;
21
+ display: grid;
22
+ place-items: center;
23
+ inline-size: 100%;
24
+ min-block-size: 10.5rem;
25
+ isolation: isolate;
26
+ }
27
+
28
+ [part="art"]::before {
29
+ content: "";
30
+ position: absolute;
31
+ inset: 18% 14%;
32
+ border-radius: 0.75rem;
33
+ background:
34
+ radial-gradient(
35
+ circle at 50% 50%,
36
+ color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 10%, var(--boe-token-surface-surface, #ffffff) 90%) 0%,
37
+ color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 4%, transparent) 58%,
38
+ transparent 100%
39
+ );
40
+ filter: blur(10px);
41
+ z-index: 0;
42
+ }
43
+
44
+ [part="asset"] {
45
+ display: grid;
46
+ place-items: center;
47
+ width: min(11rem, 72%);
48
+ max-width: 100%;
49
+ aspect-ratio: 1 / 1;
50
+ z-index: 1;
51
+ }
52
+
53
+ [part="asset"] > svg {
54
+ display: block;
55
+ width: 100%;
56
+ height: auto;
57
+ max-width: 100%;
58
+ overflow: visible;
59
+ filter: drop-shadow(0 16px 28px rgba(15, 23, 42, 0.08));
60
+ }
61
+
62
+ [part="cloud"] {
63
+ position: relative;
64
+ inline-size: 10rem;
65
+ block-size: 6.75rem;
66
+ z-index: 1;
67
+ filter: drop-shadow(0 18px 30px rgba(15, 23, 42, 0.08));
68
+ }
69
+
70
+ [part~="orb"] {
71
+ position: absolute;
72
+ display: block;
73
+ border-radius: 999px;
74
+ background:
75
+ linear-gradient(
76
+ 180deg,
77
+ color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 34%, var(--boe-token-surface-surface, #ffffff) 66%) 0%,
78
+ color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 16%, var(--boe-token-surface-surface-secondary, #fbfbfb) 84%) 100%
79
+ );
80
+ border: 1px solid color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 22%, transparent);
81
+ box-shadow: 0 14px 26px rgba(15, 23, 42, 0.1);
82
+ }
83
+
84
+ [part~="orb-a"] {
85
+ inline-size: 4rem;
86
+ block-size: 4rem;
87
+ inset: 1.9rem auto auto 0.4rem;
88
+ }
89
+
90
+ [part~="orb-b"] {
91
+ inline-size: 5rem;
92
+ block-size: 5rem;
93
+ inset: 0.35rem auto auto 2.55rem;
94
+ }
95
+
96
+ [part~="orb-c"] {
97
+ inline-size: 3.85rem;
98
+ block-size: 3.85rem;
99
+ inset: 2.15rem auto auto 5.95rem;
100
+ }
101
+
102
+ [part="stack"] {
103
+ position: relative;
104
+ inline-size: 10rem;
105
+ block-size: 7rem;
106
+ z-index: 1;
107
+ filter: drop-shadow(0 18px 30px rgba(15, 23, 42, 0.08));
108
+ }
109
+
110
+ [part~="stack-card"] {
111
+ position: absolute;
112
+ inset: 1rem auto auto 1.7rem;
113
+ display: block;
114
+ inline-size: 6.6rem;
115
+ block-size: 4.8rem;
116
+ border-radius: 0.75rem;
117
+ background: var(--boe-token-surface-surface, #ffffff);
118
+ border: 1px solid color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 16%, transparent);
119
+ box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
120
+ }
121
+
122
+ [part~="stack-card-one"] {
123
+ transform: rotate(-10deg);
124
+ }
125
+
126
+ [part~="stack-card-two"] {
127
+ transform: rotate(0deg);
128
+ }
129
+
130
+ [part~="stack-card-three"] {
131
+ transform: rotate(10deg);
132
+ }
133
+
134
+ [part="spark-cluster"] {
135
+ position: relative;
136
+ inline-size: 9rem;
137
+ block-size: 7rem;
138
+ z-index: 1;
139
+ }
140
+
141
+ [part~="spark"] {
142
+ position: absolute;
143
+ display: block;
144
+ inline-size: 1rem;
145
+ block-size: 1rem;
146
+ background: color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 52%, transparent);
147
+ clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
148
+ filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.12));
149
+ }
150
+
151
+ [part~="spark-a"] {
152
+ inset: 3.2rem auto auto 1rem;
153
+ }
154
+
155
+ [part~="spark-b"] {
156
+ inline-size: 1.6rem;
157
+ block-size: 1.6rem;
158
+ inset: 0.9rem auto auto 3.8rem;
159
+ }
160
+
161
+ [part~="spark-c"] {
162
+ inset: 3.35rem auto auto 6.9rem;
163
+ }
164
+
165
+ [part="meta"] {
166
+ display: grid;
167
+ gap: 0.45rem;
168
+ justify-items: center;
169
+ max-inline-size: 28rem;
170
+ }
171
+
172
+ [part="title"] {
173
+ font-weight: 700;
174
+ font-size: 1rem;
175
+ line-height: 1.2;
176
+ }
177
+
178
+ [part="title"][hidden] {
179
+ display: none;
180
+ }
181
+
182
+ [part~="caption"] {
183
+ color: var(--boe-token-text-text-secondary, #6f6f6f);
184
+ line-height: 1.5;
185
+ }
186
+
187
+ [part~="caption"][hidden] {
188
+ display: none;
189
+ }
190
+ `;
191
+ export class BoxIllustrationElement extends BaseElement {
192
+ handleDesignSystemChange = () => {
193
+ this.update();
194
+ };
195
+ static get observedAttributes() {
196
+ return ["asset", "caption", "message", "shape", "heading"];
197
+ }
198
+ figureEl;
199
+ artEl;
200
+ titleEl;
201
+ captionEl;
202
+ artSignature = "";
203
+ get caption() {
204
+ return this.getAttribute("caption") ?? this.message;
205
+ }
206
+ set caption(value) {
207
+ this.setAttribute("caption", value);
208
+ }
209
+ get asset() {
210
+ return this.getAttribute("asset") ?? "";
211
+ }
212
+ set asset(value) {
213
+ this.setAttribute("asset", value);
214
+ }
215
+ get message() {
216
+ return this.getAttribute("message") ?? this.getAttribute("caption") ?? "";
217
+ }
218
+ set message(value) {
219
+ this.setAttribute("message", value);
220
+ }
221
+ get shape() {
222
+ return this.getAttribute("shape") ?? "cloud";
223
+ }
224
+ set shape(value) {
225
+ this.setAttribute("shape", value);
226
+ }
227
+ get heading() {
228
+ return this.getAttribute("heading") ?? "";
229
+ }
230
+ set heading(value) {
231
+ this.setAttribute("heading", value);
232
+ }
233
+ connectedCallback() {
234
+ globalThis.addEventListener?.(DESIGN_SYSTEM_CHANGE_EVENT, this.handleDesignSystemChange);
235
+ super.connectedCallback();
236
+ }
237
+ disconnectedCallback() {
238
+ globalThis.removeEventListener?.(DESIGN_SYSTEM_CHANGE_EVENT, this.handleDesignSystemChange);
239
+ }
240
+ renderShape() {
241
+ switch (this.shape) {
242
+ case "spark":
243
+ return `<div part="spark-cluster"><span part="spark spark-a"></span><span part="spark spark-b"></span><span part="spark spark-c"></span></div>`;
244
+ case "stack":
245
+ return `<div part="stack"><span part="stack-card stack-card-one"></span><span part="stack-card stack-card-two"></span><span part="stack-card stack-card-three"></span></div>`;
246
+ default:
247
+ return `<div part="cloud"><span part="orb orb-a"></span><span part="orb orb-b"></span><span part="orb orb-c"></span></div>`;
248
+ }
249
+ }
250
+ renderTemplate() {
251
+ if (!this.shadowRoot) {
252
+ return;
253
+ }
254
+ this.shadowRoot.innerHTML = `
255
+ <style>${illustrationStyles}</style>
256
+ <figure part="illustration">
257
+ <div part="art"></div>
258
+ <figcaption part="meta">
259
+ <h2 part="title" hidden></h2>
260
+ <span part="message caption" hidden></span>
261
+ </figcaption>
262
+ </figure>
263
+ `;
264
+ this.figureEl = this.shadowRoot.querySelector('[part="illustration"]');
265
+ this.artEl = this.shadowRoot.querySelector('[part="art"]');
266
+ this.titleEl = this.shadowRoot.querySelector('[part="title"]');
267
+ this.captionEl = this.shadowRoot.querySelector('[part~="caption"]');
268
+ }
269
+ update() {
270
+ if (!this.figureEl) {
271
+ return;
272
+ }
273
+ const illustrationMarkup = this.asset ? resolveDesignIllustration(this.asset) : null;
274
+ const artMarkup = illustrationMarkup ? `<div part="asset">${illustrationMarkup}</div>` : this.renderShape();
275
+ const signature = `${this.asset}|${this.shape}|${illustrationMarkup ?? ""}`;
276
+ this.figureEl.dataset.shape = this.shape;
277
+ this.artEl.dataset.assetSource = illustrationMarkup ? "design-system" : "shape";
278
+ if (signature !== this.artSignature) {
279
+ this.artSignature = signature;
280
+ this.artEl.innerHTML = artMarkup;
281
+ }
282
+ if (this.heading) {
283
+ this.titleEl.hidden = false;
284
+ this.titleEl.textContent = this.heading;
285
+ }
286
+ else {
287
+ this.titleEl.hidden = true;
288
+ this.titleEl.textContent = "";
289
+ }
290
+ if (this.message) {
291
+ this.captionEl.hidden = false;
292
+ this.captionEl.textContent = this.message;
293
+ }
294
+ else {
295
+ this.captionEl.hidden = true;
296
+ this.captionEl.textContent = "";
297
+ }
298
+ // Keep image role on the art node only when there is no visible text alternative,
299
+ // so a heading in figcaption is not swallowed by presentational descendants.
300
+ if (this.heading || this.message) {
301
+ this.artEl.setAttribute("aria-hidden", "true");
302
+ this.artEl.removeAttribute("role");
303
+ this.artEl.removeAttribute("aria-label");
304
+ }
305
+ else {
306
+ this.artEl.removeAttribute("aria-hidden");
307
+ this.artEl.setAttribute("role", "img");
308
+ this.artEl.setAttribute("aria-label", "Illustration");
309
+ }
310
+ }
311
+ }
312
+ export const defineBoxIllustrationElement = (tagName = DEFAULT_TAG_NAME) => {
313
+ const existingElement = customElements.get(tagName);
314
+ if (existingElement) {
315
+ return existingElement;
316
+ }
317
+ customElements.define(tagName, BoxIllustrationElement);
318
+ return BoxIllustrationElement;
319
+ };
@@ -0,0 +1,11 @@
1
+ import { TypedEventEmitter, type EventMap, type Unsubscribe } from "./event-emitter.js";
2
+ export declare abstract class Controller<TState, TEvents extends EventMap> {
3
+ protected readonly events: TypedEventEmitter<TEvents>;
4
+ protected state: TState;
5
+ protected constructor(initialState: TState);
6
+ getState(): Readonly<TState>;
7
+ subscribe<TKey extends keyof TEvents>(eventName: TKey, listener: (payload: TEvents[TKey]) => void): Unsubscribe;
8
+ protected setState(nextState: TState): void;
9
+ protected emit<TKey extends keyof TEvents>(eventName: TKey, payload: TEvents[TKey]): void;
10
+ destroy(): void;
11
+ }
@@ -0,0 +1,23 @@
1
+ import { TypedEventEmitter } from "./event-emitter.js";
2
+ export class Controller {
3
+ events = new TypedEventEmitter();
4
+ state;
5
+ constructor(initialState) {
6
+ this.state = initialState;
7
+ }
8
+ getState() {
9
+ return this.state;
10
+ }
11
+ subscribe(eventName, listener) {
12
+ return this.events.on(eventName, listener);
13
+ }
14
+ setState(nextState) {
15
+ this.state = nextState;
16
+ }
17
+ emit(eventName, payload) {
18
+ this.events.emit(eventName, payload);
19
+ }
20
+ destroy() {
21
+ this.events.clear();
22
+ }
23
+ }
@@ -0,0 +1,22 @@
1
+ export declare abstract class BaseElement extends HTMLElement {
2
+ protected isRendered: boolean;
3
+ constructor();
4
+ connectedCallback(): void;
5
+ disconnectedCallback(): void;
6
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
7
+ /**
8
+ * Subclasses override this to define the initial Shadow DOM structure and styles.
9
+ * This is only run once during the first connectedCallback.
10
+ */
11
+ protected abstract renderTemplate(): void;
12
+ /**
13
+ * Subclasses override this to register event listeners on elements within their Shadow DOM.
14
+ * This is only run once during the first connectedCallback.
15
+ */
16
+ protected setupListeners(): void;
17
+ /**
18
+ * Subclasses override this to perform in-place mutations (text content, classes,
19
+ * attributes, dataset etc.) on existing Shadow DOM nodes when state changes.
20
+ */
21
+ protected abstract update(): void;
22
+ }
@@ -0,0 +1,28 @@
1
+ export class BaseElement extends HTMLElement {
2
+ isRendered = false;
3
+ constructor() {
4
+ super();
5
+ this.attachShadow({ mode: "open" });
6
+ }
7
+ connectedCallback() {
8
+ if (!this.isRendered) {
9
+ this.renderTemplate();
10
+ this.isRendered = true;
11
+ this.setupListeners();
12
+ }
13
+ this.update();
14
+ }
15
+ disconnectedCallback() {
16
+ // Optional teardown for subclasses to override
17
+ }
18
+ attributeChangedCallback(name, oldValue, newValue) {
19
+ if (this.isRendered && oldValue !== newValue) {
20
+ this.update();
21
+ }
22
+ }
23
+ /**
24
+ * Subclasses override this to register event listeners on elements within their Shadow DOM.
25
+ * This is only run once during the first connectedCallback.
26
+ */
27
+ setupListeners() { }
28
+ }
@@ -0,0 +1,9 @@
1
+ export type Unsubscribe = () => void;
2
+ export type EventMap = object;
3
+ export declare class TypedEventEmitter<TEvents extends EventMap> {
4
+ private listeners;
5
+ on<TKey extends keyof TEvents>(eventName: TKey, listener: (payload: TEvents[TKey]) => void): Unsubscribe;
6
+ off<TKey extends keyof TEvents>(eventName: TKey, listener: (payload: TEvents[TKey]) => void): void;
7
+ emit<TKey extends keyof TEvents>(eventName: TKey, payload: TEvents[TKey]): void;
8
+ clear(): void;
9
+ }
@@ -0,0 +1,33 @@
1
+ export class TypedEventEmitter {
2
+ listeners = new Map();
3
+ on(eventName, listener) {
4
+ const eventListeners = this.listeners.get(eventName) ?? new Set();
5
+ eventListeners.add(listener);
6
+ this.listeners.set(eventName, eventListeners);
7
+ return () => {
8
+ this.off(eventName, listener);
9
+ };
10
+ }
11
+ off(eventName, listener) {
12
+ const eventListeners = this.listeners.get(eventName);
13
+ if (!eventListeners) {
14
+ return;
15
+ }
16
+ eventListeners.delete(listener);
17
+ if (eventListeners.size === 0) {
18
+ this.listeners.delete(eventName);
19
+ }
20
+ }
21
+ emit(eventName, payload) {
22
+ const eventListeners = this.listeners.get(eventName);
23
+ if (!eventListeners) {
24
+ return;
25
+ }
26
+ for (const listener of eventListeners) {
27
+ listener(payload);
28
+ }
29
+ }
30
+ clear() {
31
+ this.listeners.clear();
32
+ }
33
+ }
@@ -0,0 +1,63 @@
1
+ import { BaseElement } from "./element.js";
2
+ /**
3
+ * Form-associated custom element base for Batch 5.
4
+ *
5
+ * Subclasses set `static formAssociated = true` (inherited), call
6
+ * `syncFormAssociation()` whenever the submitted value or validity changes,
7
+ * and implement `getFormValue` / `restoreFormValue`.
8
+ *
9
+ * jsdom's `ElementInternals` stubs omit `setFormValue` / `setValidity`; we keep
10
+ * a mirror store so unit tests can assert submission values via
11
+ * `getMirroredFormValue`.
12
+ */
13
+ export type FormValue = string | File | FormData | null;
14
+ export declare const getMirroredFormValue: (internals: ElementInternals) => FormValue;
15
+ /** Build a multi-entry FormData payload (empty selection → `null`). */
16
+ export declare const formDataFromNamedValues: (name: string, values: readonly string[]) => FormData | null;
17
+ /** Restore string[] from FormData / JSON / comma-separated / single string. */
18
+ export declare const stringValuesFromFormValue: (value: FormValue, name: string) => string[];
19
+ /** Range pair as FormData (`${name}-start` / `${name}-end`). */
20
+ export declare const formDataFromRange: (name: string, start: number, end: number) => FormData;
21
+ export declare const rangeFromFormValue: (value: FormValue, name: string, fallback: {
22
+ start: number;
23
+ end: number;
24
+ }) => {
25
+ start: number;
26
+ end: number;
27
+ };
28
+ /** Shared invalid-state styles using the status-error token. */
29
+ export declare const boeFormFieldErrorStyles = "\n :host([invalid]) [part=\"input\"],\n :host([invalid]) [part=\"textarea\"],\n :host([invalid]) [part=\"select\"],\n :host([invalid]) [part=\"control\"],\n :host([invalid]) [part=\"editor\"] {\n border-color: var(--boe-token-surface-status-surface-error, #ed3757);\n }\n\n :host([invalid]) [part=\"input\"]:focus-visible,\n :host([invalid]) [part=\"textarea\"]:focus-visible,\n :host([invalid]) [part=\"select\"]:focus-visible,\n :host([invalid]) [part=\"control\"]:focus-visible {\n border-color: var(--boe-token-surface-status-surface-error, #ed3757);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--boe-token-surface-status-surface-error, #ed3757) 22%, transparent);\n }\n\n [part=\"error-message\"] {\n margin: 0;\n color: var(--boe-token-surface-status-surface-error, #ed3757);\n font-size: 0.82rem;\n line-height: 1.35;\n }\n\n [part=\"error-message\"][hidden] {\n display: none;\n }\n";
30
+ export declare const FORM_ERROR_MESSAGE_ID = "boe-field-error";
31
+ export declare const formErrorMessageMarkup: () => string;
32
+ export declare abstract class FormAssociatedElement extends BaseElement {
33
+ static formAssociated: boolean;
34
+ /** Attributes every form control should observe (merge into subclass lists). */
35
+ static readonly formObservedAttributes: readonly ["name", "invalid", "error-message"];
36
+ /** ElementInternals for form association (public for tests / advanced hosts). */
37
+ readonly internals: ElementInternals;
38
+ private defaultFormValue;
39
+ private defaultCaptured;
40
+ constructor();
41
+ get name(): string;
42
+ set name(value: string);
43
+ get invalid(): boolean;
44
+ set invalid(value: boolean);
45
+ get errorMessage(): string;
46
+ set errorMessage(value: string);
47
+ /** Value reported to the owning form (`null` omits the control). */
48
+ protected abstract getFormValue(): FormValue;
49
+ /** Restore a value from form reset / autocomplete. */
50
+ protected abstract restoreFormValue(value: FormValue): void;
51
+ connectedCallback(): void;
52
+ formResetCallback(): void;
53
+ formStateRestoreCallback(state: string | File | FormData | null): void;
54
+ /** Push the current value + validity into ElementInternals. */
55
+ protected syncFormAssociation(): void;
56
+ /**
57
+ * Apply `aria-invalid` / `aria-errormessage` on the focusable control and
58
+ * update the error message region.
59
+ */
60
+ protected applyInvalidState(control: HTMLElement | null | undefined, messageEl: HTMLElement | null | undefined): void;
61
+ /** Apply invalid ARIA to every focusable control in a multi-option field. */
62
+ protected applyInvalidStateToControls(controls: Iterable<HTMLElement | null | undefined>, messageEl: HTMLElement | null | undefined): void;
63
+ }