@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,151 @@
1
+ import { FormAssociatedElement, boeFormFieldErrorStyles, formErrorMessageMarkup, } from "../../core/index.js";
2
+ import { boeControl, boeInputControlStyles, boeSpace } from "../../foundations/geometry/index.js";
3
+ const DEFAULT_TAG_NAME = "box-text-field";
4
+ /** Input chrome tracks BUE `@mixin box-inputs` (`src/styles/_inputs.scss`). */
5
+ const textFieldStyles = `
6
+ :host {
7
+ display: block;
8
+ color: inherit;
9
+ font: inherit;
10
+ }
11
+
12
+ [part="field"] {
13
+ display: grid;
14
+ gap: ${boeSpace[2]};
15
+ }
16
+
17
+ [part="label"] {
18
+ font-size: ${boeControl.fontSize};
19
+ font-weight: 700;
20
+ color: var(--boe-token-text-text, #222222);
21
+ }
22
+
23
+ [part="input"] {
24
+ appearance: none;
25
+ width: 100%;
26
+ font: inherit;
27
+ font-size: ${boeControl.fontSize};
28
+ }
29
+
30
+ ${boeInputControlStyles('[part="input"]')}
31
+
32
+ [part="input"]::placeholder {
33
+ color: var(--boe-token-text-text-placeholder, #909090);
34
+ }
35
+
36
+ ${boeFormFieldErrorStyles}
37
+ `;
38
+ export class BoxTextFieldElement extends FormAssociatedElement {
39
+ static get observedAttributes() {
40
+ return [
41
+ ...FormAssociatedElement.formObservedAttributes,
42
+ "disabled",
43
+ "label",
44
+ "placeholder",
45
+ "value",
46
+ ];
47
+ }
48
+ valueInternal = "";
49
+ inputEl;
50
+ labelEl;
51
+ errorEl;
52
+ get value() {
53
+ return this.valueInternal;
54
+ }
55
+ set value(nextValue) {
56
+ this.valueInternal = nextValue;
57
+ this.setAttribute("value", nextValue);
58
+ if (this.isRendered) {
59
+ this.update();
60
+ }
61
+ }
62
+ get disabled() {
63
+ return this.hasAttribute("disabled");
64
+ }
65
+ set disabled(value) {
66
+ this.toggleAttribute("disabled", Boolean(value));
67
+ }
68
+ get label() {
69
+ return this.getAttribute("label") ?? "Input";
70
+ }
71
+ set label(value) {
72
+ this.setAttribute("label", value);
73
+ }
74
+ get placeholder() {
75
+ return this.getAttribute("placeholder") ?? "";
76
+ }
77
+ set placeholder(value) {
78
+ this.setAttribute("placeholder", value);
79
+ }
80
+ attributeChangedCallback(name, oldValue, newValue) {
81
+ if (name === "value") {
82
+ this.valueInternal = this.getAttribute("value") ?? "";
83
+ }
84
+ super.attributeChangedCallback(name, oldValue, newValue);
85
+ }
86
+ getFormValue() {
87
+ return this.valueInternal;
88
+ }
89
+ restoreFormValue(value) {
90
+ const next = typeof value === "string" ? value : "";
91
+ this.valueInternal = next;
92
+ this.setAttribute("value", next);
93
+ if (this.isRendered) {
94
+ this.update();
95
+ }
96
+ }
97
+ renderTemplate() {
98
+ if (!this.shadowRoot) {
99
+ return;
100
+ }
101
+ this.shadowRoot.innerHTML = `
102
+ <style>${textFieldStyles}</style>
103
+ <label part="field">
104
+ <span part="label"></span>
105
+ <input type="text" part="input" />
106
+ ${formErrorMessageMarkup()}
107
+ </label>
108
+ `;
109
+ this.labelEl = this.shadowRoot.querySelector('[part="label"]');
110
+ this.inputEl = this.shadowRoot.querySelector('[part="input"]');
111
+ this.errorEl = this.shadowRoot.querySelector('[part="error-message"]');
112
+ }
113
+ setupListeners() {
114
+ this.inputEl.addEventListener("input", event => {
115
+ const nextValue = event.currentTarget.value;
116
+ this.valueInternal = nextValue;
117
+ this.setAttribute("value", nextValue);
118
+ this.syncFormAssociation();
119
+ this.dispatchEvent(new CustomEvent("value-changed", {
120
+ bubbles: true,
121
+ composed: true,
122
+ detail: { value: nextValue },
123
+ }));
124
+ });
125
+ }
126
+ update() {
127
+ if (!this.inputEl || !this.labelEl || !this.errorEl) {
128
+ return;
129
+ }
130
+ this.labelEl.textContent = this.label;
131
+ this.inputEl.placeholder = this.placeholder;
132
+ if (this.shadowRoot?.activeElement !== this.inputEl) {
133
+ this.inputEl.value = this.valueInternal;
134
+ }
135
+ if (this.disabled) {
136
+ this.inputEl.setAttribute("disabled", "");
137
+ }
138
+ else {
139
+ this.inputEl.removeAttribute("disabled");
140
+ }
141
+ this.applyInvalidState(this.inputEl, this.errorEl);
142
+ }
143
+ }
144
+ export const defineBoxTextFieldElement = (tagName = DEFAULT_TAG_NAME) => {
145
+ const existingElement = customElements.get(tagName);
146
+ if (existingElement) {
147
+ return existingElement;
148
+ }
149
+ customElements.define(tagName, BoxTextFieldElement);
150
+ return BoxTextFieldElement;
151
+ };
@@ -0,0 +1,29 @@
1
+ import { FormAssociatedElement } from "../../core/index.js";
2
+ import type { FormValue } from "../../core/index.js";
3
+ export declare class BoxTimeFieldElement extends FormAssociatedElement {
4
+ static get observedAttributes(): string[];
5
+ private valueInternal;
6
+ private inputEl;
7
+ private labelEl;
8
+ private errorEl;
9
+ get disabled(): boolean;
10
+ set disabled(value: boolean);
11
+ get label(): string;
12
+ set label(value: string);
13
+ get max(): string;
14
+ set max(value: string);
15
+ get min(): string;
16
+ set min(value: string);
17
+ get step(): string;
18
+ set step(value: string);
19
+ get value(): string;
20
+ set value(nextValue: string);
21
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
22
+ protected getFormValue(): FormValue;
23
+ protected restoreFormValue(value: FormValue): void;
24
+ private syncValue;
25
+ protected renderTemplate(): void;
26
+ protected setupListeners(): void;
27
+ protected update(): void;
28
+ }
29
+ export declare const defineBoxTimeFieldElement: (tagName?: string) => typeof BoxTimeFieldElement;
@@ -0,0 +1,203 @@
1
+ import { FormAssociatedElement, boeFormFieldErrorStyles, formErrorMessageMarkup, } from "../../core/index.js";
2
+ import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
3
+ import { boeRadius } from "../../foundations/geometry/index.js";
4
+ const DEFAULT_TAG_NAME = "box-time-field";
5
+ const timeFieldStyles = `
6
+ :host {
7
+ display: block;
8
+ color: inherit;
9
+ font: inherit;
10
+ }
11
+
12
+ [part="field"] {
13
+ display: grid;
14
+ gap: 0.45rem;
15
+ }
16
+
17
+ [part="label"] {
18
+ font-size: 0.8rem;
19
+ font-weight: 700;
20
+ letter-spacing: 0.08em;
21
+ text-transform: uppercase;
22
+ color: var(--boe-token-text-text-secondary, #6f6f6f);
23
+ }
24
+
25
+ [part="input"] {
26
+ appearance: none;
27
+ font: inherit;
28
+ color: var(--boe-token-text-text, #222222);
29
+ accent-color: var(--boe-token-surface-surface-brand, #0061d5);
30
+ padding: 0.45rem 0.7rem;
31
+ border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 78%, var(--boe-token-surface-surface, #ffffff) 22%);
32
+ border-radius: ${boeRadius.control};
33
+ background: var(--boe-token-surface-surface, #ffffff);
34
+ transition:
35
+ border-color ${boeMotionDuration.interactive} ${boeMotionEasing.standard},
36
+ background ${boeMotionDuration.interactive} ${boeMotionEasing.standard},
37
+ box-shadow ${boeMotionDuration.interactive} ${boeMotionEasing.standard};
38
+ }
39
+
40
+ [part="input"]:hover:not(:disabled) {
41
+ border-color: var(--boe-token-stroke-stroke-hover, #bcbcbc);
42
+ }
43
+
44
+ [part="input"]:focus-visible {
45
+ outline: none;
46
+ border-color: var(--boe-token-surface-surface-brand, #0061d5);
47
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 18%, transparent);
48
+ }
49
+
50
+ [part="input"]:disabled {
51
+ opacity: 0.55;
52
+ cursor: not-allowed;
53
+ }
54
+
55
+ ${boeFormFieldErrorStyles}
56
+ `;
57
+ export class BoxTimeFieldElement extends FormAssociatedElement {
58
+ static get observedAttributes() {
59
+ return [
60
+ ...FormAssociatedElement.formObservedAttributes,
61
+ "disabled",
62
+ "label",
63
+ "max",
64
+ "min",
65
+ "step",
66
+ "value",
67
+ ];
68
+ }
69
+ valueInternal = "";
70
+ inputEl;
71
+ labelEl;
72
+ errorEl;
73
+ get disabled() {
74
+ return this.hasAttribute("disabled");
75
+ }
76
+ set disabled(value) {
77
+ if (value) {
78
+ this.setAttribute("disabled", "");
79
+ }
80
+ else {
81
+ this.removeAttribute("disabled");
82
+ }
83
+ }
84
+ get label() {
85
+ return this.getAttribute("label") ?? "Time";
86
+ }
87
+ set label(value) {
88
+ this.setAttribute("label", value);
89
+ }
90
+ get max() {
91
+ return this.getAttribute("max") ?? "";
92
+ }
93
+ set max(value) {
94
+ this.setAttribute("max", value);
95
+ }
96
+ get min() {
97
+ return this.getAttribute("min") ?? "";
98
+ }
99
+ set min(value) {
100
+ this.setAttribute("min", value);
101
+ }
102
+ get step() {
103
+ return this.getAttribute("step") ?? "60";
104
+ }
105
+ set step(value) {
106
+ this.setAttribute("step", value);
107
+ }
108
+ get value() {
109
+ return this.valueInternal;
110
+ }
111
+ set value(nextValue) {
112
+ this.valueInternal = nextValue;
113
+ this.setAttribute("value", nextValue);
114
+ if (this.isRendered) {
115
+ this.update();
116
+ }
117
+ }
118
+ attributeChangedCallback(name, oldValue, newValue) {
119
+ if (name === "value") {
120
+ this.valueInternal = this.getAttribute("value") ?? "";
121
+ }
122
+ super.attributeChangedCallback(name, oldValue, newValue);
123
+ }
124
+ getFormValue() {
125
+ return this.valueInternal;
126
+ }
127
+ restoreFormValue(value) {
128
+ const next = typeof value === "string" ? value : "";
129
+ this.valueInternal = next;
130
+ this.setAttribute("value", next);
131
+ if (this.isRendered) {
132
+ this.update();
133
+ }
134
+ }
135
+ syncValue(nextValue) {
136
+ this.valueInternal = nextValue;
137
+ this.setAttribute("value", nextValue);
138
+ this.syncFormAssociation();
139
+ this.dispatchEvent(new CustomEvent("value-changed", {
140
+ bubbles: true,
141
+ composed: true,
142
+ detail: { value: nextValue },
143
+ }));
144
+ }
145
+ renderTemplate() {
146
+ if (!this.shadowRoot) {
147
+ return;
148
+ }
149
+ this.shadowRoot.innerHTML = `
150
+ <style>${timeFieldStyles}</style>
151
+ <label part="field">
152
+ <span part="label"></span>
153
+ <input type="time" part="input" />
154
+ ${formErrorMessageMarkup()}
155
+ </label>
156
+ `;
157
+ this.labelEl = this.shadowRoot.querySelector('[part="label"]');
158
+ this.inputEl = this.shadowRoot.querySelector('[part="input"]');
159
+ this.errorEl = this.shadowRoot.querySelector('[part="error-message"]');
160
+ }
161
+ setupListeners() {
162
+ this.inputEl.addEventListener("input", event => {
163
+ this.syncValue(event.currentTarget.value);
164
+ });
165
+ }
166
+ update() {
167
+ if (!this.inputEl || !this.labelEl || !this.errorEl) {
168
+ return;
169
+ }
170
+ this.labelEl.textContent = this.label;
171
+ this.inputEl.step = this.step;
172
+ if (this.min) {
173
+ this.inputEl.min = this.min;
174
+ }
175
+ else {
176
+ this.inputEl.removeAttribute("min");
177
+ }
178
+ if (this.max) {
179
+ this.inputEl.max = this.max;
180
+ }
181
+ else {
182
+ this.inputEl.removeAttribute("max");
183
+ }
184
+ if (this.shadowRoot?.activeElement !== this.inputEl) {
185
+ this.inputEl.value = this.valueInternal;
186
+ }
187
+ if (this.disabled) {
188
+ this.inputEl.setAttribute("disabled", "");
189
+ }
190
+ else {
191
+ this.inputEl.removeAttribute("disabled");
192
+ }
193
+ this.applyInvalidState(this.inputEl, this.errorEl);
194
+ }
195
+ }
196
+ export const defineBoxTimeFieldElement = (tagName = DEFAULT_TAG_NAME) => {
197
+ const existingElement = customElements.get(tagName);
198
+ if (existingElement) {
199
+ return existingElement;
200
+ }
201
+ customElements.define(tagName, BoxTimeFieldElement);
202
+ return BoxTimeFieldElement;
203
+ };
@@ -0,0 +1,21 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ export declare class BoxAvatarElement extends BaseElement {
3
+ static get observedAttributes(): string[];
4
+ private avatarEl;
5
+ get alt(): string;
6
+ set alt(value: string);
7
+ get initials(): string;
8
+ set initials(value: string);
9
+ get name(): string;
10
+ set name(value: string);
11
+ get size(): number;
12
+ set size(value: number);
13
+ get src(): string;
14
+ set src(value: string);
15
+ get tone(): string;
16
+ set tone(value: string);
17
+ protected renderTemplate(): void;
18
+ protected update(): void;
19
+ private showAvatarFallback;
20
+ }
21
+ export declare const defineBoxAvatarElement: (tagName?: string) => typeof BoxAvatarElement;
@@ -0,0 +1,191 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ const DEFAULT_TAG_NAME = "box-avatar";
3
+ /** BUE default avatar size (`Avatar.scss` `.avatar`). */
4
+ const DEFAULT_SIZE = 32;
5
+ /** BUE `$avatar-colors` / `avatarColors` from box-ui-elements variables. */
6
+ const AVATAR_COLORS = [
7
+ "#0061d5",
8
+ "#003c84",
9
+ "#6f6f6f",
10
+ "#222222",
11
+ "#4826c2",
12
+ "#9f3fed",
13
+ ];
14
+ const resolveSize = (raw, fallback = DEFAULT_SIZE) => {
15
+ const parsed = Number(raw ?? String(fallback));
16
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
17
+ };
18
+ const initialsFromName = (name) => name
19
+ .trim()
20
+ .split(/\s+/)
21
+ .slice(0, 2)
22
+ .map(segment => segment[0] ?? "")
23
+ .join("")
24
+ .toUpperCase();
25
+ const avatarColorFor = (seed) => {
26
+ if (!seed) {
27
+ return AVATAR_COLORS[0];
28
+ }
29
+ let hash = 0;
30
+ for (let i = 0; i < seed.length; i += 1) {
31
+ hash = (hash + seed.charCodeAt(i) * (i + 1)) % AVATAR_COLORS.length;
32
+ }
33
+ return AVATAR_COLORS[hash] ?? AVATAR_COLORS[0];
34
+ };
35
+ const avatarStyles = `
36
+ :host {
37
+ display: inline-block;
38
+ color: inherit;
39
+ font: inherit;
40
+ }
41
+
42
+ [part="avatar"] {
43
+ position: relative;
44
+ display: inline-grid;
45
+ place-items: center;
46
+ overflow: hidden;
47
+ flex-grow: 0;
48
+ flex-shrink: 0;
49
+ border-radius: 100%;
50
+ border: 0;
51
+ background: var(--avatar-bg, #0061d5);
52
+ box-shadow: none;
53
+ user-select: none;
54
+ }
55
+
56
+ [part="image"] {
57
+ position: absolute;
58
+ inset: 0;
59
+ inline-size: 100%;
60
+ block-size: 100%;
61
+ object-fit: cover;
62
+ border-radius: 100%;
63
+ }
64
+
65
+ [part="fallback"] {
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ font-weight: 700;
70
+ color: #ffffff;
71
+ line-height: 1;
72
+ letter-spacing: 0;
73
+ font-size: calc(var(--avatar-size, ${DEFAULT_SIZE}px) * 0.375);
74
+ }
75
+
76
+ [part="image"][hidden] {
77
+ display: none;
78
+ }
79
+ `;
80
+ export class BoxAvatarElement extends BaseElement {
81
+ static get observedAttributes() {
82
+ return ["alt", "initials", "name", "size", "src", "tone"];
83
+ }
84
+ avatarEl;
85
+ get alt() {
86
+ return this.getAttribute("alt") ?? this.name;
87
+ }
88
+ set alt(value) {
89
+ this.setAttribute("alt", value);
90
+ }
91
+ get initials() {
92
+ return this.getAttribute("initials") ?? initialsFromName(this.name);
93
+ }
94
+ set initials(value) {
95
+ this.setAttribute("initials", value);
96
+ }
97
+ get name() {
98
+ return this.getAttribute("name") ?? "";
99
+ }
100
+ set name(value) {
101
+ this.setAttribute("name", value);
102
+ }
103
+ get size() {
104
+ return resolveSize(this.getAttribute("size"));
105
+ }
106
+ set size(value) {
107
+ this.setAttribute("size", String(value));
108
+ }
109
+ get src() {
110
+ return this.getAttribute("src") ?? "";
111
+ }
112
+ set src(value) {
113
+ this.setAttribute("src", value);
114
+ }
115
+ get tone() {
116
+ return this.getAttribute("tone") ?? "neutral";
117
+ }
118
+ set tone(value) {
119
+ this.setAttribute("tone", value);
120
+ }
121
+ renderTemplate() {
122
+ if (!this.shadowRoot) {
123
+ return;
124
+ }
125
+ this.shadowRoot.innerHTML = `
126
+ <style>${avatarStyles}</style>
127
+ <div part="avatar"></div>
128
+ `;
129
+ this.avatarEl = this.shadowRoot.querySelector('[part="avatar"]');
130
+ }
131
+ update() {
132
+ if (!this.avatarEl) {
133
+ return;
134
+ }
135
+ const size = this.size;
136
+ const fallback = this.initials || "?";
137
+ const colorSeed = this.name || this.initials || this.alt || fallback;
138
+ this.avatarEl.dataset.tone = this.tone;
139
+ this.avatarEl.setAttribute("aria-label", this.alt || fallback);
140
+ this.avatarEl.style.setProperty("--avatar-size", `${size}px`);
141
+ this.avatarEl.style.setProperty("--avatar-bg", avatarColorFor(colorSeed));
142
+ this.avatarEl.style.width = `${size}px`;
143
+ this.avatarEl.style.height = `${size}px`;
144
+ const existingImage = this.avatarEl.querySelector('[part="image"]');
145
+ const existingFallback = this.avatarEl.querySelector('[part="fallback"]');
146
+ const nextSrc = this.src;
147
+ if (nextSrc) {
148
+ const image = existingImage ?? document.createElement("img");
149
+ image.setAttribute("part", "image");
150
+ image.alt = this.alt;
151
+ const currentSrc = image.getAttribute("src");
152
+ if (currentSrc !== nextSrc) {
153
+ image.src = nextSrc;
154
+ image.hidden = false;
155
+ image.onerror = () => {
156
+ image.hidden = true;
157
+ this.showAvatarFallback(existingFallback, fallback);
158
+ };
159
+ image.onload = () => {
160
+ image.hidden = false;
161
+ this.avatarEl.querySelector('[part="fallback"]')?.remove();
162
+ };
163
+ }
164
+ if (!existingImage) {
165
+ this.avatarEl.append(image);
166
+ }
167
+ }
168
+ else {
169
+ if (existingImage) {
170
+ existingImage.remove();
171
+ }
172
+ this.showAvatarFallback(existingFallback, fallback);
173
+ }
174
+ }
175
+ showAvatarFallback(existingFallback, fallback) {
176
+ const fallbackEl = existingFallback ?? document.createElement("span");
177
+ fallbackEl.setAttribute("part", "fallback");
178
+ fallbackEl.textContent = fallback;
179
+ if (!existingFallback) {
180
+ this.avatarEl.append(fallbackEl);
181
+ }
182
+ }
183
+ }
184
+ export const defineBoxAvatarElement = (tagName = DEFAULT_TAG_NAME) => {
185
+ const existingElement = customElements.get(tagName);
186
+ if (existingElement) {
187
+ return existingElement;
188
+ }
189
+ customElements.define(tagName, BoxAvatarElement);
190
+ return BoxAvatarElement;
191
+ };
@@ -0,0 +1,31 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ /**
3
+ * A selectable contact row for a people picker — an avatar (image or initials),
4
+ * a name, and a secondary email/handle. Like `box-datalist-item` it is a
5
+ * `role="option"` that emits `select` with its `value` on click or Enter/Space
6
+ * and reflects `selected` to `aria-selected`; the host owns the list.
7
+ */
8
+ export declare class BoxContactDatalistItemElement extends BaseElement {
9
+ static get observedAttributes(): string[];
10
+ private itemEl;
11
+ private avatarEl;
12
+ private nameEl;
13
+ private emailEl;
14
+ get name(): string;
15
+ set name(value: string);
16
+ get email(): string;
17
+ set email(value: string);
18
+ get src(): string;
19
+ set src(value: string);
20
+ get value(): string;
21
+ set value(value: string);
22
+ get selected(): boolean;
23
+ set selected(value: boolean);
24
+ get disabled(): boolean;
25
+ set disabled(value: boolean);
26
+ private choose;
27
+ protected renderTemplate(): void;
28
+ protected setupListeners(): void;
29
+ protected update(): void;
30
+ }
31
+ export declare const defineBoxContactDatalistItemElement: (tagName?: string) => typeof BoxContactDatalistItemElement;