@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,293 @@
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-search-field";
5
+ const searchFieldStyles = `
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-shell"] {
26
+ display: flex;
27
+ align-items: center;
28
+ gap: 0.4rem;
29
+ padding: 0.25rem 0.25rem 0.25rem 0.65rem;
30
+ border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 78%, var(--boe-token-surface-surface, #ffffff) 22%);
31
+ border-radius: ${boeRadius.field};
32
+ background: var(--boe-token-surface-surface, #ffffff);
33
+ transition:
34
+ border-color ${boeMotionDuration.interactive} ${boeMotionEasing.standard},
35
+ background ${boeMotionDuration.interactive} ${boeMotionEasing.standard},
36
+ box-shadow ${boeMotionDuration.interactive} ${boeMotionEasing.standard};
37
+ }
38
+
39
+ [part="input-shell"]:hover {
40
+ border-color: var(--boe-token-stroke-stroke-hover, #bcbcbc);
41
+ }
42
+
43
+ [part="input-shell"]:focus-within {
44
+ border-color: var(--boe-token-surface-surface-brand, #0061d5);
45
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 18%, transparent);
46
+ }
47
+
48
+ [part="input"] {
49
+ appearance: none;
50
+ flex: 1 1 auto;
51
+ min-inline-size: 0;
52
+ border: none;
53
+ background: transparent;
54
+ font: inherit;
55
+ color: var(--boe-token-text-text, #222222);
56
+ padding: 0.3rem 0;
57
+ }
58
+
59
+ [part="input"]::placeholder {
60
+ color: var(--boe-token-text-text-placeholder, #909090);
61
+ }
62
+
63
+ [part="input"]:focus {
64
+ outline: none;
65
+ }
66
+
67
+ [part="input"]:disabled {
68
+ opacity: 0.55;
69
+ cursor: not-allowed;
70
+ }
71
+
72
+ [part="submit"],
73
+ [part="clear"] {
74
+ appearance: none;
75
+ flex: 0 0 auto;
76
+ font: inherit;
77
+ font-weight: 600;
78
+ padding: 0.35rem 0.7rem;
79
+ border-radius: ${boeRadius.control};
80
+ cursor: pointer;
81
+ transition:
82
+ background ${boeMotionDuration.interactive} ${boeMotionEasing.standard},
83
+ border-color ${boeMotionDuration.interactive} ${boeMotionEasing.standard},
84
+ box-shadow ${boeMotionDuration.interactive} ${boeMotionEasing.standard};
85
+ }
86
+
87
+ [part="submit"] {
88
+ border: 1px solid transparent;
89
+ background: var(--boe-token-surface-surface-brand, #0061d5);
90
+ color: var(--boe-token-text-text-on-brand, #ffffff);
91
+ }
92
+
93
+ [part="submit"]:hover:not(:disabled) {
94
+ background: var(--boe-token-surface-surface-brand-hover, #006ae9);
95
+ }
96
+
97
+ [part="submit"]:active:not(:disabled) {
98
+ background: var(--boe-token-surface-surface-brand-pressed, #004eac);
99
+ }
100
+
101
+ [part="clear"] {
102
+ border: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 78%, var(--boe-token-surface-surface, #ffffff) 22%);
103
+ background: color-mix(in srgb, var(--boe-token-surface-surface, #ffffff) 88%, var(--boe-token-surface-surface-secondary, #fbfbfb) 12%);
104
+ color: var(--boe-token-text-text-secondary, #6f6f6f);
105
+ }
106
+
107
+ [part="clear"]:hover:not(:disabled) {
108
+ border-color: var(--boe-token-stroke-stroke-hover, #bcbcbc);
109
+ background: var(--boe-token-surface-surface-hover, #f4f4f4);
110
+ }
111
+
112
+ [part="submit"]:focus-visible,
113
+ [part="clear"]:focus-visible {
114
+ outline: none;
115
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 18%, transparent);
116
+ }
117
+
118
+ [part="submit"]:disabled,
119
+ [part="clear"]:disabled {
120
+ opacity: 0.55;
121
+ cursor: not-allowed;
122
+ }
123
+
124
+ ${boeFormFieldErrorStyles}
125
+ `;
126
+ export class BoxSearchFieldElement extends FormAssociatedElement {
127
+ static get observedAttributes() {
128
+ return [
129
+ ...FormAssociatedElement.formObservedAttributes,
130
+ "disabled",
131
+ "label",
132
+ "placeholder",
133
+ "value",
134
+ ];
135
+ }
136
+ valueInternal = "";
137
+ inputEl;
138
+ labelEl;
139
+ submitEl;
140
+ clearEl;
141
+ errorEl;
142
+ get value() {
143
+ return this.valueInternal;
144
+ }
145
+ set value(nextValue) {
146
+ this.valueInternal = nextValue;
147
+ this.setAttribute("value", nextValue);
148
+ if (this.isRendered) {
149
+ this.update();
150
+ }
151
+ }
152
+ get disabled() {
153
+ return this.hasAttribute("disabled");
154
+ }
155
+ set disabled(value) {
156
+ if (value) {
157
+ this.setAttribute("disabled", "");
158
+ }
159
+ else {
160
+ this.removeAttribute("disabled");
161
+ }
162
+ }
163
+ get label() {
164
+ return this.getAttribute("label") ?? "Search";
165
+ }
166
+ set label(value) {
167
+ this.setAttribute("label", value);
168
+ }
169
+ get placeholder() {
170
+ return this.getAttribute("placeholder") ?? "Search";
171
+ }
172
+ set placeholder(value) {
173
+ this.setAttribute("placeholder", value);
174
+ }
175
+ attributeChangedCallback(name, oldValue, newValue) {
176
+ if (name === "value") {
177
+ this.valueInternal = this.getAttribute("value") ?? "";
178
+ }
179
+ super.attributeChangedCallback(name, oldValue, newValue);
180
+ }
181
+ clear() {
182
+ if (this.disabled || !this.valueInternal) {
183
+ return;
184
+ }
185
+ this.value = "";
186
+ this.syncFormAssociation();
187
+ this.dispatchEvent(new CustomEvent("clear", { bubbles: true, composed: true, detail: { value: "" } }));
188
+ this.dispatchEvent(new CustomEvent("value-changed", { bubbles: true, composed: true, detail: { value: "" } }));
189
+ }
190
+ getFormValue() {
191
+ return this.valueInternal;
192
+ }
193
+ restoreFormValue(value) {
194
+ const next = typeof value === "string" ? value : "";
195
+ this.valueInternal = next;
196
+ this.setAttribute("value", next);
197
+ if (this.isRendered) {
198
+ this.update();
199
+ }
200
+ }
201
+ renderTemplate() {
202
+ if (!this.shadowRoot) {
203
+ return;
204
+ }
205
+ this.shadowRoot.innerHTML = `
206
+ <style>${searchFieldStyles}</style>
207
+ <label part="field">
208
+ <span part="label"></span>
209
+ <div part="input-shell">
210
+ <input type="search" part="input" />
211
+ <button type="button" part="submit">Search</button>
212
+ <button type="button" part="clear">Clear</button>
213
+ </div>
214
+ ${formErrorMessageMarkup()}
215
+ </label>
216
+ `;
217
+ this.labelEl = this.shadowRoot.querySelector('[part="label"]');
218
+ this.inputEl = this.shadowRoot.querySelector('[part="input"]');
219
+ this.submitEl = this.shadowRoot.querySelector('[part="submit"]');
220
+ this.clearEl = this.shadowRoot.querySelector('[part="clear"]');
221
+ this.errorEl = this.shadowRoot.querySelector('[part="error-message"]');
222
+ }
223
+ setupListeners() {
224
+ this.inputEl.addEventListener("input", event => {
225
+ if (this.disabled) {
226
+ return;
227
+ }
228
+ const nextValue = event.currentTarget.value;
229
+ this.valueInternal = nextValue;
230
+ this.setAttribute("value", nextValue);
231
+ this.syncFormAssociation();
232
+ this.clearEl.disabled = this.disabled || nextValue.length === 0;
233
+ this.dispatchEvent(new CustomEvent("value-changed", {
234
+ bubbles: true,
235
+ composed: true,
236
+ detail: { value: nextValue },
237
+ }));
238
+ });
239
+ this.inputEl.addEventListener("keydown", event => {
240
+ if (this.disabled) {
241
+ return;
242
+ }
243
+ if (event.key === "Enter") {
244
+ this.dispatchEvent(new CustomEvent("search", {
245
+ bubbles: true,
246
+ composed: true,
247
+ detail: { value: this.valueInternal },
248
+ }));
249
+ }
250
+ });
251
+ this.submitEl.addEventListener("click", () => {
252
+ if (this.disabled) {
253
+ return;
254
+ }
255
+ this.dispatchEvent(new CustomEvent("search", {
256
+ bubbles: true,
257
+ composed: true,
258
+ detail: { value: this.valueInternal },
259
+ }));
260
+ });
261
+ this.clearEl.addEventListener("click", () => {
262
+ this.clear();
263
+ });
264
+ }
265
+ update() {
266
+ if (!this.inputEl || !this.labelEl || !this.submitEl || !this.clearEl || !this.errorEl) {
267
+ return;
268
+ }
269
+ this.labelEl.textContent = this.label;
270
+ this.inputEl.placeholder = this.placeholder;
271
+ if (this.shadowRoot?.activeElement !== this.inputEl) {
272
+ this.inputEl.value = this.valueInternal;
273
+ }
274
+ if (this.disabled) {
275
+ this.inputEl.setAttribute("disabled", "");
276
+ this.submitEl.setAttribute("disabled", "");
277
+ }
278
+ else {
279
+ this.inputEl.removeAttribute("disabled");
280
+ this.submitEl.removeAttribute("disabled");
281
+ }
282
+ this.clearEl.disabled = this.disabled || this.valueInternal.length === 0;
283
+ this.applyInvalidState(this.inputEl, this.errorEl);
284
+ }
285
+ }
286
+ export const defineBoxSearchFieldElement = (tagName = DEFAULT_TAG_NAME) => {
287
+ const existingElement = customElements.get(tagName);
288
+ if (existingElement) {
289
+ return existingElement;
290
+ }
291
+ customElements.define(tagName, BoxSearchFieldElement);
292
+ return BoxSearchFieldElement;
293
+ };
@@ -0,0 +1,30 @@
1
+ import { FormAssociatedElement } from "../../core/index.js";
2
+ import type { FormValue } from "../../core/index.js";
3
+ export declare class BoxSelectElement extends FormAssociatedElement {
4
+ static get observedAttributes(): string[];
5
+ private valueInternal;
6
+ private selectEl;
7
+ private labelEl;
8
+ private errorEl;
9
+ get value(): string;
10
+ set value(nextValue: string);
11
+ get disabled(): boolean;
12
+ set disabled(value: boolean);
13
+ get label(): string;
14
+ set label(value: string);
15
+ get options(): Array<{
16
+ label: string;
17
+ value: string;
18
+ }>;
19
+ set options(value: Array<{
20
+ label: string;
21
+ value: string;
22
+ }>);
23
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
24
+ protected getFormValue(): FormValue;
25
+ protected restoreFormValue(value: FormValue): void;
26
+ protected renderTemplate(): void;
27
+ protected setupListeners(): void;
28
+ protected update(): void;
29
+ }
30
+ export declare const defineBoxSelectElement: (tagName?: string) => typeof BoxSelectElement;
@@ -0,0 +1,198 @@
1
+ import { FormAssociatedElement, boeFormFieldErrorStyles, formErrorMessageMarkup, } from "../../core/index.js";
2
+ import { boeControl, boeRadius, boeSpace } from "../../foundations/geometry/index.js";
3
+ const DEFAULT_TAG_NAME = "box-select";
4
+ const escapeHtml = (value) => value
5
+ .replaceAll("&", "&amp;")
6
+ .replaceAll("<", "&lt;")
7
+ .replaceAll(">", "&gt;")
8
+ .replaceAll('"', "&quot;")
9
+ .replaceAll("'", "&#39;");
10
+ /** Select chrome tracks BUE select / `@mixin box-inputs` (height ~34px, radius 6). */
11
+ const selectStyles = `
12
+ :host {
13
+ display: block;
14
+ color: inherit;
15
+ font: inherit;
16
+ }
17
+
18
+ [part="field"] {
19
+ display: grid;
20
+ gap: ${boeSpace[2]};
21
+ }
22
+
23
+ [part="label"] {
24
+ font-size: ${boeControl.fontSize};
25
+ font-weight: 700;
26
+ color: var(--boe-token-text-text, #222222);
27
+ }
28
+
29
+ [part="select"] {
30
+ appearance: none;
31
+ box-sizing: border-box;
32
+ width: 100%;
33
+ min-height: ${boeControl.selectHeight};
34
+ padding: 5px 25px 5px 10px;
35
+ font: inherit;
36
+ font-size: ${boeControl.fontSize};
37
+ color: var(--boe-token-text-text, #222222);
38
+ border: 1px solid ${boeControl.inputBorder};
39
+ border-radius: ${boeRadius.control};
40
+ /* Chevron stroke matches --boe-token-text-text-secondary fallback (#6f6f6f). */
41
+ background:
42
+ url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236f6f6f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 12px 8px,
43
+ var(--boe-token-surface-surface, #ffffff);
44
+ box-shadow: 0 1px 1px 1px rgb(0 0 0 / 5%);
45
+ cursor: pointer;
46
+ transition:
47
+ border-color linear 0.15s,
48
+ box-shadow linear 0.1s;
49
+ }
50
+
51
+ [part="select"]:hover:not(:disabled) {
52
+ border-color: var(--boe-token-stroke-stroke-hover, #bcbcbc);
53
+ }
54
+
55
+ [part="select"]:focus-visible {
56
+ outline: 0;
57
+ border-color: var(--boe-token-surface-surface-brand, #0061d5);
58
+ box-shadow: 0 1px 1px 1px rgb(0 0 0 / 5%);
59
+ }
60
+
61
+ [part="select"]:disabled {
62
+ opacity: ${boeControl.disabledOpacity};
63
+ cursor: not-allowed;
64
+ }
65
+
66
+ ${boeFormFieldErrorStyles}
67
+ `;
68
+ export class BoxSelectElement extends FormAssociatedElement {
69
+ static get observedAttributes() {
70
+ return [
71
+ ...FormAssociatedElement.formObservedAttributes,
72
+ "disabled",
73
+ "label",
74
+ "options",
75
+ "value",
76
+ ];
77
+ }
78
+ valueInternal = "";
79
+ selectEl;
80
+ labelEl;
81
+ errorEl;
82
+ get value() {
83
+ return this.valueInternal;
84
+ }
85
+ set value(nextValue) {
86
+ this.valueInternal = nextValue;
87
+ this.setAttribute("value", nextValue);
88
+ if (this.isRendered) {
89
+ this.update();
90
+ }
91
+ }
92
+ get disabled() {
93
+ return this.hasAttribute("disabled");
94
+ }
95
+ set disabled(value) {
96
+ if (value) {
97
+ this.setAttribute("disabled", "");
98
+ }
99
+ else {
100
+ this.removeAttribute("disabled");
101
+ }
102
+ }
103
+ get label() {
104
+ return this.getAttribute("label") ?? "Select";
105
+ }
106
+ set label(value) {
107
+ this.setAttribute("label", value);
108
+ }
109
+ get options() {
110
+ const raw = this.getAttribute("options");
111
+ if (!raw) {
112
+ return [];
113
+ }
114
+ try {
115
+ const parsed = JSON.parse(raw);
116
+ return Array.isArray(parsed) ? parsed : [];
117
+ }
118
+ catch {
119
+ return [];
120
+ }
121
+ }
122
+ set options(value) {
123
+ this.setAttribute("options", JSON.stringify(value));
124
+ }
125
+ attributeChangedCallback(name, oldValue, newValue) {
126
+ if (name === "value") {
127
+ this.valueInternal = this.getAttribute("value") ?? "";
128
+ }
129
+ super.attributeChangedCallback(name, oldValue, newValue);
130
+ }
131
+ getFormValue() {
132
+ return this.valueInternal;
133
+ }
134
+ restoreFormValue(value) {
135
+ const next = typeof value === "string" ? value : "";
136
+ this.valueInternal = next;
137
+ this.setAttribute("value", next);
138
+ if (this.isRendered) {
139
+ this.update();
140
+ }
141
+ }
142
+ renderTemplate() {
143
+ if (!this.shadowRoot) {
144
+ return;
145
+ }
146
+ this.shadowRoot.innerHTML = `
147
+ <style>${selectStyles}</style>
148
+ <label part="field">
149
+ <span part="label"></span>
150
+ <select part="select"></select>
151
+ ${formErrorMessageMarkup()}
152
+ </label>
153
+ `;
154
+ this.labelEl = this.shadowRoot.querySelector('[part="label"]');
155
+ this.selectEl = this.shadowRoot.querySelector('[part="select"]');
156
+ this.errorEl = this.shadowRoot.querySelector('[part="error-message"]');
157
+ }
158
+ setupListeners() {
159
+ this.selectEl.addEventListener("change", event => {
160
+ const nextValue = event.currentTarget.value;
161
+ this.valueInternal = nextValue;
162
+ this.setAttribute("value", nextValue);
163
+ this.syncFormAssociation();
164
+ this.dispatchEvent(new CustomEvent("value-changed", {
165
+ bubbles: true,
166
+ composed: true,
167
+ detail: { value: nextValue },
168
+ }));
169
+ });
170
+ }
171
+ update() {
172
+ if (!this.selectEl || !this.labelEl || !this.errorEl) {
173
+ return;
174
+ }
175
+ this.labelEl.textContent = this.label;
176
+ // Rebuild options (the list itself may change)
177
+ this.selectEl.innerHTML = this.options
178
+ .map(option => `<option value="${escapeHtml(option.value)}">${escapeHtml(option.label)}</option>`)
179
+ .join("");
180
+ // Patch selected value and disabled after rebuilding options
181
+ this.selectEl.value = this.valueInternal;
182
+ if (this.disabled) {
183
+ this.selectEl.setAttribute("disabled", "");
184
+ }
185
+ else {
186
+ this.selectEl.removeAttribute("disabled");
187
+ }
188
+ this.applyInvalidState(this.selectEl, this.errorEl);
189
+ }
190
+ }
191
+ export const defineBoxSelectElement = (tagName = DEFAULT_TAG_NAME) => {
192
+ const existingElement = customElements.get(tagName);
193
+ if (existingElement) {
194
+ return existingElement;
195
+ }
196
+ customElements.define(tagName, BoxSelectElement);
197
+ return BoxSelectElement;
198
+ };
@@ -0,0 +1,31 @@
1
+ import { FormAssociatedElement } from "../../core/index.js";
2
+ import type { FormValue } from "../../core/index.js";
3
+ export declare class BoxSliderElement extends FormAssociatedElement {
4
+ static get observedAttributes(): string[];
5
+ private valueInternal;
6
+ private inputEl;
7
+ private labelEl;
8
+ private valueEl;
9
+ private errorEl;
10
+ get disabled(): boolean;
11
+ set disabled(value: boolean);
12
+ get label(): string;
13
+ set label(value: string);
14
+ get max(): number;
15
+ set max(value: number);
16
+ get min(): number;
17
+ set min(value: number);
18
+ get step(): number;
19
+ set step(value: number);
20
+ get value(): number;
21
+ set value(nextValue: number);
22
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
23
+ protected getFormValue(): FormValue;
24
+ protected restoreFormValue(value: FormValue): void;
25
+ private clamp;
26
+ private syncValue;
27
+ protected renderTemplate(): void;
28
+ protected setupListeners(): void;
29
+ protected update(): void;
30
+ }
31
+ export declare const defineBoxSliderElement: (tagName?: string) => typeof BoxSliderElement;