@nldd/design-system 0.11.0 → 0.13.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 (268) hide show
  1. package/custom-elements.json +2726 -617
  2. package/dist/components/actions/button-group/button-group.d.ts +4 -3
  3. package/dist/components/actions/button-group/button-group.d.ts.map +1 -1
  4. package/dist/components/actions/button-group/button-group.js +4 -3
  5. package/dist/components/actions/button-group/button-group.js.map +1 -1
  6. package/dist/components/actions/button-group/button-group.styles.d.ts.map +1 -1
  7. package/dist/components/actions/button-group/button-group.styles.js +6 -6
  8. package/dist/components/actions/button-group/button-group.styles.js.map +1 -1
  9. package/dist/components/actions/menu/menu.d.ts.map +1 -1
  10. package/dist/components/actions/menu/menu.js +3 -0
  11. package/dist/components/actions/menu/menu.js.map +1 -1
  12. package/dist/components/components.js +21704 -19266
  13. package/dist/components/content/avatar/avatar.d.ts +2 -1
  14. package/dist/components/content/avatar/avatar.d.ts.map +1 -1
  15. package/dist/components/content/avatar/avatar.js +12 -1
  16. package/dist/components/content/avatar/avatar.js.map +1 -1
  17. package/dist/components/content/avatar-group/avatar-group.d.ts +30 -2
  18. package/dist/components/content/avatar-group/avatar-group.d.ts.map +1 -1
  19. package/dist/components/content/avatar-group/avatar-group.i18n.d.ts +1 -0
  20. package/dist/components/content/avatar-group/avatar-group.i18n.d.ts.map +1 -1
  21. package/dist/components/content/avatar-group/avatar-group.i18n.js +1 -0
  22. package/dist/components/content/avatar-group/avatar-group.i18n.js.map +1 -1
  23. package/dist/components/content/avatar-group/avatar-group.js +96 -7
  24. package/dist/components/content/avatar-group/avatar-group.js.map +1 -1
  25. package/dist/components/content/avatar-group/avatar-group.styles.d.ts.map +1 -1
  26. package/dist/components/content/avatar-group/avatar-group.styles.js +35 -1
  27. package/dist/components/content/avatar-group/avatar-group.styles.js.map +1 -1
  28. package/dist/components/content/avatar-group/avatar-group.template.d.ts +1 -0
  29. package/dist/components/content/avatar-group/avatar-group.template.d.ts.map +1 -1
  30. package/dist/components/content/avatar-group/avatar-group.template.js +52 -29
  31. package/dist/components/content/avatar-group/avatar-group.template.js.map +1 -1
  32. package/dist/components/content/code-viewer/code-viewer.d.ts +14 -1
  33. package/dist/components/content/code-viewer/code-viewer.d.ts.map +1 -1
  34. package/dist/components/content/code-viewer/code-viewer.diff.d.ts +40 -0
  35. package/dist/components/content/code-viewer/code-viewer.diff.d.ts.map +1 -0
  36. package/dist/components/content/code-viewer/code-viewer.diff.js +261 -0
  37. package/dist/components/content/code-viewer/code-viewer.diff.js.map +1 -0
  38. package/dist/components/content/code-viewer/code-viewer.i18n.d.ts +5 -0
  39. package/dist/components/content/code-viewer/code-viewer.i18n.d.ts.map +1 -1
  40. package/dist/components/content/code-viewer/code-viewer.i18n.js +9 -0
  41. package/dist/components/content/code-viewer/code-viewer.i18n.js.map +1 -1
  42. package/dist/components/content/code-viewer/code-viewer.js +98 -6
  43. package/dist/components/content/code-viewer/code-viewer.js.map +1 -1
  44. package/dist/components/content/code-viewer/code-viewer.styles.d.ts.map +1 -1
  45. package/dist/components/content/code-viewer/code-viewer.styles.js +180 -14
  46. package/dist/components/content/code-viewer/code-viewer.styles.js.map +1 -1
  47. package/dist/components/content/code-viewer/code-viewer.template.d.ts.map +1 -1
  48. package/dist/components/content/code-viewer/code-viewer.template.js +5 -4
  49. package/dist/components/content/code-viewer/code-viewer.template.js.map +1 -1
  50. package/dist/components/content/icon/icon-aliases.d.ts.map +1 -1
  51. package/dist/components/content/icon/icon-aliases.js +32 -4
  52. package/dist/components/content/icon/icon-aliases.js.map +1 -1
  53. package/dist/components/content/icon/icon-gallery-status.d.ts.map +1 -1
  54. package/dist/components/content/icon/icon-gallery-status.js +19 -0
  55. package/dist/components/content/icon/icon-gallery-status.js.map +1 -1
  56. package/dist/components/content/icon/icon-registry.d.ts.map +1 -1
  57. package/dist/components/content/icon/icon-registry.js +19 -4
  58. package/dist/components/content/icon/icon-registry.js.map +1 -1
  59. package/dist/components/content/rich-text/rich-text.d.ts +10 -0
  60. package/dist/components/content/rich-text/rich-text.d.ts.map +1 -1
  61. package/dist/components/content/rich-text/rich-text.js +10 -0
  62. package/dist/components/content/rich-text/rich-text.js.map +1 -1
  63. package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
  64. package/dist/components/content/tooltip/tooltip.js +2 -0
  65. package/dist/components/content/tooltip/tooltip.js.map +1 -1
  66. package/dist/components/{dist-Bo5Jeyfn.js → dist-B5E3q-ea.js} +2 -1
  67. package/dist/components/{dist-DbNhCpS5.js → dist-BFw_yEMS.js} +2 -1
  68. package/dist/components/{dist-DnZmcpbQ.js → dist-BNLAXAyO.js} +2 -1
  69. package/dist/components/{dist-DkqAbJH8.js → dist-BOVSVPSz.js} +1 -1
  70. package/dist/components/{dist-Ch3gNAuT.js → dist-BPB3rWnd.js} +2 -1
  71. package/dist/components/{dist-Bud_7w5g.js → dist-BWlUmyq3.js} +34 -2869
  72. package/dist/components/dist-CC8oiVtm.js +366 -0
  73. package/dist/components/dist-COKR0tYU.js +2860 -0
  74. package/dist/components/{dist-CaxHkqR2.js → dist-Co-tsc9S.js} +4 -3
  75. package/dist/components/{dist-iC2RTM0V.js → dist-D_9ZyZ5v.js} +3 -2
  76. package/dist/components/{dist-BB5mlo7D.js → dist-Dn9pjiud.js} +3 -2
  77. package/dist/components/{dist-B2QcygzG.js → dist-Dz28se9B.js} +2 -1
  78. package/dist/components/{dist-CA0yDFIt.js → dist-IPm8ilWf.js} +3 -2
  79. package/dist/components/{icon-zNX9A6d3.js → icon-BJHKWhY5.js} +39 -8
  80. package/dist/components/{icon-button-Cntrg4_E.js → icon-button-DhBIq6lN.js} +75 -2
  81. package/dist/components/inputs/code-editor/code-editor.d.ts +4 -54
  82. package/dist/components/inputs/code-editor/code-editor.d.ts.map +1 -1
  83. package/dist/components/inputs/code-editor/code-editor.js +22 -262
  84. package/dist/components/inputs/code-editor/code-editor.js.map +1 -1
  85. package/dist/components/inputs/code-editor/code-editor.styles.d.ts.map +1 -1
  86. package/dist/components/inputs/code-editor/code-editor.styles.js +43 -6
  87. package/dist/components/inputs/code-editor/code-editor.styles.js.map +1 -1
  88. package/dist/components/inputs/date-picker/date-picker.d.ts +2 -2
  89. package/dist/components/inputs/date-picker/date-picker.i18n.d.ts +1 -1
  90. package/dist/components/inputs/date-picker/date-picker.i18n.js +1 -1
  91. package/dist/components/inputs/date-picker/date-picker.i18n.js.map +1 -1
  92. package/dist/components/inputs/date-picker/date-picker.template.js +1 -1
  93. package/dist/components/inputs/date-picker/date-picker.template.js.map +1 -1
  94. package/dist/components/inputs/file-field/file-field.d.ts +86 -10
  95. package/dist/components/inputs/file-field/file-field.d.ts.map +1 -1
  96. package/dist/components/inputs/file-field/file-field.drop.d.ts +34 -0
  97. package/dist/components/inputs/file-field/file-field.drop.d.ts.map +1 -0
  98. package/dist/components/inputs/file-field/file-field.drop.js +176 -0
  99. package/dist/components/inputs/file-field/file-field.drop.js.map +1 -0
  100. package/dist/components/inputs/file-field/file-field.i18n.d.ts +20 -1
  101. package/dist/components/inputs/file-field/file-field.i18n.d.ts.map +1 -1
  102. package/dist/components/inputs/file-field/file-field.i18n.js +20 -1
  103. package/dist/components/inputs/file-field/file-field.i18n.js.map +1 -1
  104. package/dist/components/inputs/file-field/file-field.js +283 -15
  105. package/dist/components/inputs/file-field/file-field.js.map +1 -1
  106. package/dist/components/inputs/file-field/file-field.styles.d.ts.map +1 -1
  107. package/dist/components/inputs/file-field/file-field.styles.js +245 -10
  108. package/dist/components/inputs/file-field/file-field.styles.js.map +1 -1
  109. package/dist/components/inputs/file-field/file-field.template.d.ts +1 -0
  110. package/dist/components/inputs/file-field/file-field.template.d.ts.map +1 -1
  111. package/dist/components/inputs/file-field/file-field.template.js +167 -28
  112. package/dist/components/inputs/file-field/file-field.template.js.map +1 -1
  113. package/dist/components/inputs/file-field/file-field.truncate.d.ts +22 -0
  114. package/dist/components/inputs/file-field/file-field.truncate.d.ts.map +1 -0
  115. package/dist/components/inputs/file-field/file-field.truncate.js +62 -0
  116. package/dist/components/inputs/file-field/file-field.truncate.js.map +1 -0
  117. package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.d.ts.map +1 -1
  118. package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.js +9 -7
  119. package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.js.map +1 -1
  120. package/dist/components/inputs/text-editor/text-editor.annotations.js +1 -1
  121. package/dist/components/inputs/text-editor/text-editor.annotations.js.map +1 -1
  122. package/dist/components/inputs/text-editor/text-editor.clipboard.d.ts +16 -0
  123. package/dist/components/inputs/text-editor/text-editor.clipboard.d.ts.map +1 -0
  124. package/dist/components/inputs/text-editor/text-editor.clipboard.js +50 -0
  125. package/dist/components/inputs/text-editor/text-editor.clipboard.js.map +1 -0
  126. package/dist/components/inputs/text-editor/text-editor.code-copy.d.ts +10 -0
  127. package/dist/components/inputs/text-editor/text-editor.code-copy.d.ts.map +1 -0
  128. package/dist/components/inputs/text-editor/text-editor.code-copy.js +141 -0
  129. package/dist/components/inputs/text-editor/text-editor.code-copy.js.map +1 -0
  130. package/dist/components/inputs/text-editor/text-editor.commands.d.ts.map +1 -1
  131. package/dist/components/inputs/text-editor/text-editor.commands.js +31 -58
  132. package/dist/components/inputs/text-editor/text-editor.commands.js.map +1 -1
  133. package/dist/components/inputs/text-editor/text-editor.d.ts +17 -64
  134. package/dist/components/inputs/text-editor/text-editor.d.ts.map +1 -1
  135. package/dist/components/inputs/text-editor/text-editor.drag.d.ts.map +1 -1
  136. package/dist/components/inputs/text-editor/text-editor.drag.js +2 -1
  137. package/dist/components/inputs/text-editor/text-editor.drag.js.map +1 -1
  138. package/dist/components/inputs/text-editor/text-editor.focus-selection.d.ts +3 -0
  139. package/dist/components/inputs/text-editor/text-editor.focus-selection.d.ts.map +1 -0
  140. package/dist/components/inputs/text-editor/text-editor.focus-selection.js +55 -0
  141. package/dist/components/inputs/text-editor/text-editor.focus-selection.js.map +1 -0
  142. package/dist/components/inputs/text-editor/text-editor.hidden-syntax.d.ts +6 -0
  143. package/dist/components/inputs/text-editor/text-editor.hidden-syntax.d.ts.map +1 -0
  144. package/dist/components/inputs/text-editor/text-editor.hidden-syntax.js +305 -0
  145. package/dist/components/inputs/text-editor/text-editor.hidden-syntax.js.map +1 -0
  146. package/dist/components/inputs/text-editor/text-editor.i18n.d.ts +5 -0
  147. package/dist/components/inputs/text-editor/text-editor.i18n.d.ts.map +1 -1
  148. package/dist/components/inputs/text-editor/text-editor.i18n.js +7 -0
  149. package/dist/components/inputs/text-editor/text-editor.i18n.js.map +1 -1
  150. package/dist/components/inputs/text-editor/text-editor.js +126 -315
  151. package/dist/components/inputs/text-editor/text-editor.js.map +1 -1
  152. package/dist/components/inputs/text-editor/text-editor.keymap.d.ts +6 -0
  153. package/dist/components/inputs/text-editor/text-editor.keymap.d.ts.map +1 -0
  154. package/dist/components/inputs/text-editor/text-editor.keymap.js +38 -0
  155. package/dist/components/inputs/text-editor/text-editor.keymap.js.map +1 -0
  156. package/dist/components/inputs/text-editor/text-editor.links.d.ts.map +1 -1
  157. package/dist/components/inputs/text-editor/text-editor.links.js +11 -9
  158. package/dist/components/inputs/text-editor/text-editor.links.js.map +1 -1
  159. package/dist/components/inputs/text-editor/text-editor.markdown.d.ts +1 -17
  160. package/dist/components/inputs/text-editor/text-editor.markdown.d.ts.map +1 -1
  161. package/dist/components/inputs/text-editor/text-editor.markdown.js +32 -188
  162. package/dist/components/inputs/text-editor/text-editor.markdown.js.map +1 -1
  163. package/dist/components/inputs/text-editor/text-editor.mention.d.ts +52 -0
  164. package/dist/components/inputs/text-editor/text-editor.mention.d.ts.map +1 -0
  165. package/dist/components/inputs/text-editor/text-editor.mention.js +186 -0
  166. package/dist/components/inputs/text-editor/text-editor.mention.js.map +1 -0
  167. package/dist/components/inputs/text-editor/text-editor.mentions.d.ts +0 -16
  168. package/dist/components/inputs/text-editor/text-editor.mentions.d.ts.map +1 -1
  169. package/dist/components/inputs/text-editor/text-editor.mentions.js +1 -41
  170. package/dist/components/inputs/text-editor/text-editor.mentions.js.map +1 -1
  171. package/dist/components/inputs/text-editor/text-editor.selection.d.ts +13 -0
  172. package/dist/components/inputs/text-editor/text-editor.selection.d.ts.map +1 -0
  173. package/dist/components/inputs/text-editor/text-editor.selection.js +72 -0
  174. package/dist/components/inputs/text-editor/text-editor.selection.js.map +1 -0
  175. package/dist/components/inputs/text-editor/text-editor.spellcheck.d.ts.map +1 -1
  176. package/dist/components/inputs/text-editor/text-editor.spellcheck.js +4 -6
  177. package/dist/components/inputs/text-editor/text-editor.spellcheck.js.map +1 -1
  178. package/dist/components/inputs/text-editor/text-editor.styles.d.ts.map +1 -1
  179. package/dist/components/inputs/text-editor/text-editor.styles.js +301 -60
  180. package/dist/components/inputs/text-editor/text-editor.styles.js.map +1 -1
  181. package/dist/components/inputs/text-editor/text-editor.syntax.d.ts +22 -0
  182. package/dist/components/inputs/text-editor/text-editor.syntax.d.ts.map +1 -1
  183. package/dist/components/inputs/text-editor/text-editor.syntax.js +44 -0
  184. package/dist/components/inputs/text-editor/text-editor.syntax.js.map +1 -1
  185. package/dist/components/inputs/text-editor/text-editor.tasks.d.ts +17 -0
  186. package/dist/components/inputs/text-editor/text-editor.tasks.d.ts.map +1 -0
  187. package/dist/components/inputs/text-editor/text-editor.tasks.js +109 -0
  188. package/dist/components/inputs/text-editor/text-editor.tasks.js.map +1 -0
  189. package/dist/components/layout/page-sections/hero/hero-corner.styles.d.ts.map +1 -1
  190. package/dist/components/layout/page-sections/hero/hero-corner.styles.js +61 -0
  191. package/dist/components/layout/page-sections/hero/hero-corner.styles.js.map +1 -1
  192. package/dist/components/layout/page-sections/hero/hero.d.ts +1 -1
  193. package/dist/components/layout/page-sections/hero/hero.js +1 -1
  194. package/dist/components/layout/popover/popover.d.ts +6 -0
  195. package/dist/components/layout/popover/popover.d.ts.map +1 -1
  196. package/dist/components/layout/popover/popover.js +16 -0
  197. package/dist/components/layout/popover/popover.js.map +1 -1
  198. package/dist/components/layout/popover/popover.styles.d.ts.map +1 -1
  199. package/dist/components/layout/popover/popover.styles.js +13 -0
  200. package/dist/components/layout/popover/popover.styles.js.map +1 -1
  201. package/dist/components/navigation/document-tab-bar/document-tab-bar.d.ts.map +1 -1
  202. package/dist/components/navigation/document-tab-bar/document-tab-bar.js +5 -0
  203. package/dist/components/navigation/document-tab-bar/document-tab-bar.js.map +1 -1
  204. package/dist/components/navigation/menu-bar/menu-bar.d.ts.map +1 -1
  205. package/dist/components/navigation/menu-bar/menu-bar.js +2 -0
  206. package/dist/components/navigation/menu-bar/menu-bar.js.map +1 -1
  207. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts.map +1 -1
  208. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js +3 -0
  209. package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js.map +1 -1
  210. package/dist/components/status-and-feedback/banner/banner.d.ts +1 -1
  211. package/dist/components/status-and-feedback/banner/banner.js +2 -2
  212. package/dist/components/status-and-feedback/banner/banner.js.map +1 -1
  213. package/dist/components/status-and-feedback/notification/notification.d.ts +3 -2
  214. package/dist/components/status-and-feedback/notification/notification.d.ts.map +1 -1
  215. package/dist/components/status-and-feedback/notification/notification.js +9 -4
  216. package/dist/components/status-and-feedback/notification/notification.js.map +1 -1
  217. package/dist/components/status-and-feedback/notification/notification.styles.d.ts.map +1 -1
  218. package/dist/components/status-and-feedback/notification/notification.styles.js +18 -0
  219. package/dist/components/status-and-feedback/notification/notification.styles.js.map +1 -1
  220. package/dist/components/status-and-feedback/notification/notifications-area.d.ts.map +1 -1
  221. package/dist/components/status-and-feedback/notification/notifications-area.js +14 -0
  222. package/dist/components/status-and-feedback/notification/notifications-area.js.map +1 -1
  223. package/dist/components/status-and-feedback/progress-bar/progress-bar.i18n.d.ts +1 -1
  224. package/dist/components/status-and-feedback/progress-bar/progress-bar.i18n.js +1 -1
  225. package/dist/components/status-and-feedback/progress-bar/progress-bar.i18n.js.map +1 -1
  226. package/dist/components/status-and-feedback/progress-bar/progress-bar.js +1 -1
  227. package/dist/components/status-and-feedback/progress-bar/progress-bar.js.map +1 -1
  228. package/dist/components/status-and-feedback/progress-circle/progress-circle.i18n.d.ts +1 -1
  229. package/dist/components/status-and-feedback/progress-circle/progress-circle.i18n.js +1 -1
  230. package/dist/components/status-and-feedback/progress-circle/progress-circle.i18n.js.map +1 -1
  231. package/dist/components/status-and-feedback/progress-circle/progress-circle.js +1 -1
  232. package/dist/components/status-and-feedback/progress-circle/progress-circle.js.map +1 -1
  233. package/dist/css/rich-text.css +61 -1
  234. package/dist/css/themes/donkergeel.css +12 -3
  235. package/dist/css/themes/geel.css +12 -3
  236. package/dist/css/themes.css +24 -6
  237. package/dist/css/variables.css +16 -10
  238. package/dist/nldd.min.js +2217 -1329
  239. package/dist/translations/en-US.d.ts.map +1 -1
  240. package/dist/translations/en-US.js +34 -4
  241. package/dist/translations/en-US.js.map +1 -1
  242. package/dist/translations/fy.d.ts.map +1 -1
  243. package/dist/translations/fy.js +29 -4
  244. package/dist/translations/fy.js.map +1 -1
  245. package/dist/translations/nl.generated.d.ts +34 -4
  246. package/dist/translations/nl.generated.d.ts.map +1 -1
  247. package/dist/translations/pap-AW.d.ts.map +1 -1
  248. package/dist/translations/pap-AW.js +29 -4
  249. package/dist/translations/pap-AW.js.map +1 -1
  250. package/dist/translations/pap-CW.d.ts.map +1 -1
  251. package/dist/translations/pap-CW.js +29 -4
  252. package/dist/translations/pap-CW.js.map +1 -1
  253. package/dist/types/vue.d.ts +43 -39
  254. package/dist/utilities/carried-context.d.ts +20 -0
  255. package/dist/utilities/carried-context.d.ts.map +1 -0
  256. package/dist/utilities/carried-context.js +76 -0
  257. package/dist/utilities/carried-context.js.map +1 -0
  258. package/dist/utilities/codemirror/codemirror-input.d.ts +90 -0
  259. package/dist/utilities/codemirror/codemirror-input.d.ts.map +1 -0
  260. package/dist/utilities/codemirror/codemirror-input.js +250 -0
  261. package/dist/utilities/codemirror/codemirror-input.js.map +1 -0
  262. package/dist/utilities/codemirror/languages.d.ts +5 -1
  263. package/dist/utilities/codemirror/languages.d.ts.map +1 -1
  264. package/dist/utilities/codemirror/languages.js +21 -1
  265. package/dist/utilities/codemirror/languages.js.map +1 -1
  266. package/dist/utilities/dismiss-from-title-bar.d.ts +1 -1
  267. package/dist/utilities/dismiss-from-title-bar.js +1 -1
  268. package/package.json +2 -1
@@ -21,6 +21,20 @@ export const fileFieldStyles = css `
21
21
  --_file-field-highlight-border-width: var(--semantics-surfaces-highlight-border-width);
22
22
  --_file-field-highlight-border-color: var(--semantics-surfaces-tinted-highlight-border-color);
23
23
  --_file-field-background-color: var(--semantics-surfaces-tinted-background-color);
24
+ --_file-field-drop-border-width: var(--semantics-surfaces-ring-thickness);
25
+ --_file-field-page-drag-border-color: light-dark(var(--primitives-color-neutral-200), var(--primitives-color-neutral-350));
26
+ --_file-field-drop-border-color: var(--semantics-controls-is-selected-indicator-color);
27
+ --_file-field-drop-background-color: var(--semantics-surfaces-accent-tinted-background-color);
28
+ --_file-field-rejected-color: var(--semantics-content-critical-color);
29
+ --_file-field-rejected-background-color: var(--semantics-surfaces-critical-tinted-background-color);
30
+ --_file-field-file-icon-size: var(--primitives-space-24);
31
+ --_file-field-actions-gap: var(--primitives-space-4);
32
+ --_file-field-browse-action-color: var(--semantics-controls-is-selected-indicator-color);
33
+ --_file-field-browse-is-hovered-highlight-border-color: light-dark(var(--primitives-color-neutral-100), var(--primitives-color-neutral-250));
34
+ --_file-field-browse-is-active-highlight-border-color: light-dark(var(--primitives-color-neutral-150), var(--primitives-color-neutral-300));
35
+ --_file-field-browse-is-hovered-background-color: light-dark(var(--primitives-color-neutral-50), var(--primitives-color-neutral-100));
36
+ --_file-field-browse-is-active-background-color: light-dark(var(--primitives-color-neutral-75), var(--primitives-color-neutral-150));
37
+ --_file-field-browse-action-font: var(--semantics-buttons-md-primary-text-font);
24
38
 
25
39
  ${inheritedTextReset}
26
40
  display: block;
@@ -46,6 +60,8 @@ export const fileFieldStyles = css `
46
60
  --_file-field-text-font: var(--semantics-input-fields-sm-text-font);
47
61
  --_file-field-clear-button-padding-right: calc((var(--_file-field-min-size) - var(--semantics-controls-xs-min-size)) / 2);
48
62
  --_file-field-validation-icon-size: var(--semantics-input-fields-sm-validation-icon-size);
63
+ --_file-field-file-icon-size: var(--primitives-space-20);
64
+ --_file-field-browse-action-font: var(--semantics-buttons-sm-primary-text-font);
49
65
  }
50
66
 
51
67
 
@@ -54,8 +70,8 @@ export const fileFieldStyles = css `
54
70
  .file-field {
55
71
  box-sizing: border-box;
56
72
  display: flex;
73
+ position: relative;
57
74
  border-radius: var(--_file-field-corner-radius);
58
- box-shadow: inset 0 0 0 var(--_file-field-highlight-border-width) var(--_file-field-highlight-border-color);
59
75
  background-color: var(--_file-field-background-color);
60
76
  width: 100%;
61
77
  min-width: 0;
@@ -64,19 +80,166 @@ export const fileFieldStyles = css `
64
80
  }
65
81
 
66
82
 
83
+ .file-field::before {
84
+ box-sizing: border-box;
85
+ position: absolute;
86
+ inset: 0;
87
+ border: var(--_file-field-highlight-border-width) solid var(--_file-field-highlight-border-color);
88
+ border-radius: inherit;
89
+ content: "";
90
+ pointer-events: none;
91
+ }
92
+
93
+ .file-field:not([class*="is-drag-"]):has(> .file-field__browse-button:hover) {
94
+ --_file-field-highlight-border-color: var(--_file-field-browse-is-hovered-highlight-border-color);
95
+ }
96
+
97
+ .file-field:not([class*="is-drag-"]):has(> .file-field__browse-button:active) {
98
+ --_file-field-highlight-border-color: var(--_file-field-browse-is-active-highlight-border-color);
99
+ }
100
+
101
+ .file-field.is-drag-page {
102
+ --_file-field-highlight-border-width: var(--_file-field-drop-border-width);
103
+ --_file-field-highlight-border-color: var(--_file-field-page-drag-border-color);
104
+ }
105
+
106
+ .file-field.is-drag-over {
107
+ --_file-field-highlight-border-width: var(--_file-field-drop-border-width);
108
+ --_file-field-highlight-border-color: var(--_file-field-drop-border-color);
109
+ --_file-field-background-color: var(--_file-field-drop-background-color);
110
+ }
111
+
112
+
113
+ .file-field.is-drag-rejected {
114
+ --_file-field-highlight-border-width: var(--_file-field-drop-border-width);
115
+ --_file-field-highlight-border-color: var(--_file-field-rejected-color);
116
+ --_file-field-background-color: var(--_file-field-rejected-background-color);
117
+ }
118
+
119
+
67
120
  /* # Elements */
68
121
 
69
122
  .file-field__input {
70
123
  display: none;
71
124
  }
72
125
 
73
- .file-field__choose-button {
126
+ .file-field__browse-button,
127
+ .file-field__replace-area {
128
+ box-sizing: border-box;
74
129
  display: flex;
75
- flex-shrink: 0;
130
+ margin: 0;
131
+ border: none;
132
+ border-radius: inherit;
133
+ padding: 0;
134
+ background: none;
135
+ min-width: 0;
136
+ min-height: var(--_file-field-min-size);
137
+ flex-grow: 1;
76
138
  align-self: stretch;
139
+ align-items: center;
140
+ justify-content: center;
141
+ color: inherit;
142
+ font: inherit;
143
+ text-align: center;
77
144
  }
78
145
 
79
- .file-field__value {
146
+ .file-field:not([class*="is-drag-"]) > .file-field__browse-button:hover {
147
+ background-color: var(--_file-field-browse-is-hovered-background-color);
148
+ }
149
+
150
+ .file-field:not([class*="is-drag-"]) > .file-field__browse-button:active {
151
+ background-color: var(--_file-field-browse-is-active-background-color);
152
+ }
153
+
154
+ .file-field__browse-button:focus-visible {
155
+ outline: var(--semantics-focus-ring-outline);
156
+ outline-offset: var(--semantics-focus-ring-outline-offset);
157
+ box-shadow: var(--semantics-focus-ring-box-shadow);
158
+ }
159
+
160
+ .file-field__browse-button:focus:not(:focus-visible) {
161
+ outline: none;
162
+ }
163
+
164
+ :host([valid]) :is(.file-field__browse-button, .file-field__replace-area),
165
+ :host([invalid]) :is(.file-field__browse-button, .file-field__replace-area) {
166
+ padding-left: calc(var(--_file-field-validation-icon-size) + var(--_file-field-validation-icon-area-padding-right));
167
+ }
168
+
169
+ .file-field__sentence {
170
+ padding-block: var(--primitives-space-8);
171
+ white-space: normal;
172
+ overflow-wrap: anywhere;
173
+ text-wrap: balance;
174
+ }
175
+
176
+ .file-field__chosen-area {
177
+ display: grid;
178
+ min-width: 0;
179
+ flex-grow: 1;
180
+ align-self: stretch;
181
+ grid-template-columns: minmax(0, 1fr);
182
+ }
183
+
184
+ .file-field__chosen-file {
185
+ display: flex;
186
+ min-width: 0;
187
+ align-items: center;
188
+ }
189
+
190
+ .file-field__chosen-file,
191
+ .file-field__replace-area {
192
+ grid-area: 1 / 1;
193
+ }
194
+
195
+ .file-field__chosen-file:not(.is-active),
196
+ .file-field__replace-area:not(.is-active) {
197
+ visibility: hidden;
198
+ }
199
+
200
+ .file-field__texts {
201
+ display: grid;
202
+ min-width: 0;
203
+ grid-template-columns: minmax(0, 1fr);
204
+ align-items: center;
205
+ }
206
+
207
+ .file-field__text {
208
+ grid-area: 1 / 1;
209
+ min-width: 0;
210
+ }
211
+
212
+ .file-field__text:not(.is-active) {
213
+ visibility: hidden;
214
+ }
215
+
216
+ .file-field__text--rejected {
217
+ white-space: normal;
218
+ overflow-wrap: anywhere;
219
+ text-wrap: balance;
220
+ }
221
+
222
+ @media (hover: none) {
223
+ :is(.file-field__text--drag, .file-field__text--drop, .file-field__text--rejected) {
224
+ display: none;
225
+ }
226
+ }
227
+
228
+ .file-field__browse-action {
229
+ color: var(--_file-field-browse-action-color);
230
+ font: var(--_file-field-browse-action-font);
231
+ }
232
+
233
+ .file-field__file-icon {
234
+ flex-shrink: 0;
235
+ margin-left: var(--_file-field-inline-padding);
236
+ width: var(--_file-field-file-icon-size);
237
+ height: var(--_file-field-file-icon-size);
238
+ color: var(--semantics-content-color);
239
+ }
240
+
241
+ .file-field__value,
242
+ .file-field__sentence {
80
243
  box-sizing: border-box;
81
244
  min-width: 0;
82
245
  padding-right: var(--_file-field-inline-padding);
@@ -84,25 +247,89 @@ export const fileFieldStyles = css `
84
247
  flex-grow: 1;
85
248
  color: var(--_file-field-value-color);
86
249
  font: var(--_file-field-text-font);
250
+ }
251
+
252
+ .file-field__value {
87
253
  text-overflow: ellipsis;
88
254
  white-space: nowrap;
89
255
  overflow: hidden;
90
256
  }
91
257
 
92
- .file-field__value.is-empty {
93
- --_file-field-value-color: var(--semantics-content-secondary-color);
258
+ :is(.file-field__text--drag, .file-field__text--drop, .file-field__text--rejected) {
259
+ font: var(--_file-field-browse-action-font);
260
+ }
261
+
262
+ .file-field__text--drop {
263
+ color: var(--_file-field-browse-action-color);
264
+ }
265
+
266
+ .file-field__text--rejected {
267
+ color: var(--_file-field-rejected-color);
94
268
  }
95
269
 
96
- .file-field__clear-button {
270
+ .file-field__hint {
271
+ color: var(--semantics-content-secondary-color);
272
+ }
273
+
274
+ .file-field__value {
275
+ padding-left: var(--primitives-space-8);
276
+ }
277
+
278
+ @media (hover: none) {
279
+ .file-field__hint {
280
+ display: none;
281
+ }
282
+ }
283
+
284
+ .file-field__name {
97
285
  display: flex;
286
+ min-width: 0;
287
+ overflow: hidden;
288
+ }
289
+
290
+ .file-field__full-name {
291
+ position: absolute;
292
+ width: 1px;
293
+ height: 1px;
294
+ clip-path: inset(50%);
295
+ white-space: nowrap;
296
+ overflow: hidden;
297
+ }
298
+
299
+ .file-field__name-start {
300
+ min-width: 0;
301
+ white-space: pre;
302
+ text-overflow: ellipsis;
303
+ overflow: hidden;
304
+ }
305
+
306
+ .file-field__name-end {
98
307
  flex-shrink: 0;
308
+ white-space: pre;
309
+ }
310
+
311
+ .file-field__actions {
312
+ display: flex;
313
+ position: relative;
314
+ flex-shrink: 0;
315
+ gap: var(--_file-field-actions-gap);
99
316
  padding-right: var(--_file-field-clear-button-padding-right);
317
+ align-items: center;
100
318
  }
101
319
 
102
- .file-field__clear-button:not(:last-child) {
320
+ .file-field__actions:not(:last-child) {
103
321
  padding-right: var(--primitives-space-0);
104
322
  }
105
323
 
324
+ .file-field__status {
325
+ position: absolute;
326
+ width: 1px;
327
+ height: 1px;
328
+ clip-path: inset(50%);
329
+ white-space: nowrap;
330
+ overflow: hidden;
331
+ }
332
+
106
333
  .file-field__validation-icon-area {
107
334
  display: flex;
108
335
  height: 100%;
@@ -129,8 +356,16 @@ export const fileFieldStyles = css `
129
356
  /* # High contrast */
130
357
 
131
358
  @media (forced-colors: active) {
132
- .file-field {
133
- border: var(--_file-field-highlight-border-width) solid CanvasText;
359
+ .file-field::before {
360
+ border-color: CanvasText;
361
+ }
362
+
363
+ .file-field.is-drag-over::before {
364
+ border-color: Highlight;
365
+ }
366
+
367
+ .file-field.is-drag-rejected::before {
368
+ border-style: dashed;
134
369
  }
135
370
  }
136
371
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"file-field.styles.js","sourceRoot":"","sources":["../../../../src/components/inputs/file-field/file-field.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;IAsB9B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GrB,CAAC"}
1
+ {"version":3,"file":"file-field.styles.js","sourceRoot":"","sources":["../../../../src/components/inputs/file-field/file-field.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoC9B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4UrB,CAAC"}
@@ -3,5 +3,6 @@ import type { NLDDFileField } from './file-field.js';
3
3
  import '../../actions/button/button.js';
4
4
  import '../../actions/icon-button/icon-button.js';
5
5
  import '../../content/icon/icon.js';
6
+ import '../../content/tooltip/tooltip.js';
6
7
  export declare function fileFieldTemplate(component: NLDDFileField): TemplateResult;
7
8
  //# sourceMappingURL=file-field.template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-field.template.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/file-field/file-field.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,MAAM,KAAK,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,gCAAgC,CAAC;AACxC,OAAO,0CAA0C,CAAC;AAClD,OAAO,4BAA4B,CAAC;AAepC,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,cAAc,CA4C1E"}
1
+ {"version":3,"file":"file-field.template.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/file-field/file-field.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,MAAM,KAAK,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,gCAAgC,CAAC;AACxC,OAAO,0CAA0C,CAAC;AAClD,OAAO,4BAA4B,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAkM1C,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,cAAc,CAyB1E"}
@@ -3,6 +3,35 @@ import { classMap } from 'lit/directives/class-map.js';
3
3
  import '../../actions/button/button.js';
4
4
  import '../../actions/icon-button/icon-button.js';
5
5
  import '../../content/icon/icon.js';
6
+ import '../../content/tooltip/tooltip.js';
7
+ import { splitName, splitForTruncation } from './file-field.truncate.js';
8
+ /** Format icons by extension; a format without one gets the plain file. */
9
+ const FORMAT_ICONS = {
10
+ pdf: 'file-pdf',
11
+ png: 'file-png',
12
+ jpg: 'file-jpg',
13
+ jpeg: 'file-jpg',
14
+ gif: 'file-gif',
15
+ webp: 'file-webp',
16
+ svg: 'file-svg',
17
+ heic: 'file-heic',
18
+ tif: 'file-tiff',
19
+ tiff: 'file-tiff',
20
+ md: 'file-markdown',
21
+ markdown: 'file-markdown',
22
+ txt: 'file-text',
23
+ odt: 'file-odt',
24
+ ods: 'file-ods',
25
+ odp: 'file-odp',
26
+ odg: 'file-odg',
27
+ odf: 'file-odf',
28
+ };
29
+ function fileIcon(files) {
30
+ if (files.length > 1)
31
+ return 'file-on-file';
32
+ const extension = splitName(files[0].name)[1].slice(1).toLowerCase();
33
+ return FORMAT_ICONS[extension] ?? 'file';
34
+ }
6
35
  function renderValidationIcon(component) {
7
36
  if (!component.invalid && !component.valid)
8
37
  return nothing;
@@ -15,11 +44,143 @@ function renderValidationIcon(component) {
15
44
  </div>
16
45
  `;
17
46
  }
18
- export function fileFieldTemplate(component) {
47
+ /**
48
+ * Every text a place in the field can show, laid over each other in one grid
49
+ * cell with only the active one visible. The place is as tall as the longest of
50
+ * them all the time, so the field keeps its height when the text changes: a
51
+ * sentence that wraps in a narrow or zoomed field does not move the target
52
+ * under a pointer that is dragging a file. The texts that only a drag brings
53
+ * (`kind`) are left out on a device without hover, where nothing is dragged.
54
+ */
55
+ function renderStack(variants) {
56
+ return html `
57
+ <span class="file-field__texts">${variants.map((variant) => html `
58
+ <span class=${classMap({
59
+ 'file-field__text': true,
60
+ 'is-active': variant.active,
61
+ [`file-field__text--${variant.kind}`]: !!variant.kind,
62
+ })}>${variant.content}</span>
63
+ `)}</span>
64
+ `;
65
+ }
66
+ /** The texts of a drag and of a refused drop, one active at most. */
67
+ function dragVariants(component, dragText, dropText) {
68
+ const rejection = component._dragRejection ?? component._rejection;
69
+ const dragging = !rejection && component._drag !== 'none';
70
+ const variants = [
71
+ { content: dragText, kind: 'drag', active: dragging && component._drag === 'page' },
72
+ { content: dropText, kind: 'drop', active: dragging && component._drag === 'over' },
73
+ { content: component._rejectionText('type'), kind: 'rejected', active: rejection === 'type' },
74
+ { content: component._rejectionText('folder'), kind: 'rejected', active: rejection === 'folder' },
75
+ ];
76
+ if (!component.multiple) {
77
+ variants.push({ content: component._rejectionText('count'), kind: 'rejected', active: rejection === 'count' });
78
+ }
79
+ return variants;
80
+ }
81
+ /** The empty field is one button over the whole surface, read as one sentence:
82
+ * "Bestand kiezen of sleep het hierheen". The validation icon sits inside it,
83
+ * so a press on the icon opens the dialog too. */
84
+ function renderBrowse(component) {
85
+ const drags = dragVariants(component, component.multiple
86
+ ? component._t('components.file-field.drag-here-multiple-text')
87
+ : component._t('components.file-field.drag-here-text'), component.multiple
88
+ ? component._t('components.file-field.drop-here-multiple-text')
89
+ : component._t('components.file-field.drop-here-text'));
90
+ const sentence = html `<span class="file-field__browse-action">${component._chooseLabel()}</span> <span class="file-field__hint">${component.multiple
91
+ ? component._t('components.file-field.drop-hint-multiple-lowercase-text')
92
+ : component._t('components.file-field.drop-hint-lowercase-text')}</span>`;
93
+ return html `
94
+ <button class="file-field__browse-button"
95
+ type="button"
96
+ aria-label=${component._chooseAccessibleLabel() || component._chooseLabel()}
97
+ ?disabled=${component.disabled}
98
+ @click=${component._handleChoose}
99
+ ><span class="file-field__sentence">${renderStack([
100
+ { content: sentence, active: !drags.some((variant) => variant.active) },
101
+ ...drags,
102
+ ])}</span>${renderValidationIcon(component)}</button>
103
+ `;
104
+ }
105
+ /** A name as it fits: cut in the middle once measured, before that cut by CSS
106
+ * with its end in view. A screen reader reads the whole name either way, and a
107
+ * name that is cut short shows whole in a tooltip. */
108
+ function renderName(component, name) {
109
+ const [start, end] = splitForTruncation(name);
110
+ const shown = component._fittedName === null
111
+ ? html `<span class="file-field__name-start">${start}</span>${end
112
+ ? html `<span class="file-field__name-end">${end}</span>`
113
+ : nothing}`
114
+ : html `<span class="file-field__name-start">${component._fittedName}</span>`;
115
+ return html `
116
+ <nldd-tooltip text=${name} timing=${component._nameTruncated ? 'delay' : 'never'}>
117
+ <span class="file-field__name" aria-hidden="true">${shown}</span>
118
+ </nldd-tooltip>
119
+ <span class="file-field__full-name">${name}</span>
120
+ `;
121
+ }
122
+ /**
123
+ * A field with a file: the row with its name and buttons, and over it, in the
124
+ * same place, the sentences of a drag, saying a drop replaces what is there.
125
+ * While files are dragged the row gives way to them; nothing can be pressed
126
+ * then. A drop that was refused says why in place of the name, with the
127
+ * buttons still there.
128
+ */
129
+ function renderChosen(component) {
130
+ const files = component.files;
19
131
  const buttonSize = component.size === 'sm' ? 'xs' : 'sm';
132
+ const dragging = component._drag !== 'none';
133
+ const refused = component._rejection;
134
+ const drags = dragVariants(component, component._t('components.file-field.replace-drag-text'), component._t('components.file-field.replace-drop-text')).map((variant) => ({ ...variant, active: variant.active && dragging }));
135
+ const nameVariants = [
136
+ { content: files.length === 1 ? renderName(component, files[0].name) : component._valueLabel(), active: !refused },
137
+ { content: component._rejectionText('type'), kind: 'rejected', active: refused === 'type' },
138
+ { content: component._rejectionText('folder'), kind: 'rejected', active: refused === 'folder' },
139
+ ];
140
+ if (!component.multiple) {
141
+ nameVariants.push({ content: component._rejectionText('count'), kind: 'rejected', active: refused === 'count' });
142
+ }
143
+ return html `
144
+ <div class="file-field__chosen-area">
145
+ <div class=${classMap({ 'file-field__chosen-file': true, 'is-active': !dragging })}>
146
+ <nldd-icon class="file-field__file-icon" icon=${fileIcon(files)} aria-hidden="true"></nldd-icon>
147
+ <span class="file-field__value">${renderStack(nameVariants)}</span>
148
+ <div class="file-field__actions">
149
+ <nldd-button
150
+ appearance="neutral-tinted"
151
+ size=${buttonSize}
152
+ text=${component._t('components.file-field.to-change-action')}
153
+ accessible-label=${component._changeAccessibleLabel() || nothing}
154
+ ?disabled=${component.disabled}
155
+ @click=${component._handleChoose}
156
+ ></nldd-button>
157
+ <nldd-icon-button
158
+ appearance="neutral-transparent"
159
+ size=${buttonSize}
160
+ icon="dismiss"
161
+ text=${component._t('components.file-field.clear-action')}
162
+ accessible-label=${component._clearAccessibleLabel()}
163
+ ?disabled=${component.disabled}
164
+ @click=${component._handleClear}
165
+ ></nldd-icon-button>
166
+ </div>
167
+ ${renderValidationIcon(component)}
168
+ </div>
169
+ <div class=${classMap({ 'file-field__replace-area': true, 'is-active': dragging })}>
170
+ <span class="file-field__sentence">${renderStack(drags)}</span>
171
+ ${renderValidationIcon(component)}
172
+ </div>
173
+ </div>
174
+ `;
175
+ }
176
+ export function fileFieldTemplate(component) {
20
177
  const hasFiles = component.files.length > 0;
21
178
  return html `
22
- <div class="file-field">
179
+ <div class=${classMap({
180
+ 'file-field': true,
181
+ 'has-files': hasFiles,
182
+ [`is-drag-${component._drag}`]: component._drag !== 'none',
183
+ })}>
23
184
  <input class="file-field__input"
24
185
  type="file"
25
186
  id=${component.inputId || nothing}
@@ -30,32 +191,10 @@ export function fileFieldTemplate(component) {
30
191
  aria-label=${component.accessibleLabel || nothing}
31
192
  @change=${component._handleInputChange}
32
193
  >
33
- <div class="file-field__choose-button">
34
- <nldd-button
35
- appearance="neutral-tinted"
36
- size=${component.size}
37
- text=${component._chooseLabel()}
38
- accessible-label=${component._chooseAccessibleLabel() || nothing}
39
- ?disabled=${component.disabled}
40
- @click=${component._handleChoose}
41
- ></nldd-button>
42
- </div>
43
- <span class=${classMap({ 'file-field__value': true, 'is-empty': !hasFiles })}>
44
- ${component._valueLabel()}
45
- </span>
46
- ${hasFiles ? html `
47
- <div class="file-field__clear-button">
48
- <nldd-icon-button
49
- appearance="neutral-transparent"
50
- size=${buttonSize}
51
- icon="dismiss"
52
- text=${component._t('components.file-field.clear-action')}
53
- ?disabled=${component.disabled}
54
- @click=${component._handleClear}
55
- ></nldd-icon-button>
56
- </div>
57
- ` : nothing}
58
- ${renderValidationIcon(component)}
194
+ ${hasFiles ? renderChosen(component) : renderBrowse(component)}
195
+ <span class="file-field__status" role="status">${component._rejection
196
+ ? component._rejectionText(component._rejection)
197
+ : component._announcement}</span>
59
198
  </div>
60
199
  `;
61
200
  }
@@ -1 +1 @@
1
- {"version":3,"file":"file-field.template.js","sourceRoot":"","sources":["../../../../src/components/inputs/file-field/file-field.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,gCAAgC,CAAC;AACxC,OAAO,0CAA0C,CAAC;AAClD,OAAO,4BAA4B,CAAC;AAEpC,SAAS,oBAAoB,CAAC,SAAwB;IACrD,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC;IAE3D,OAAO,IAAI,CAAA;;;WAGD,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;;;;EAIhD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAwB;IACzD,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACzD,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAE5C,OAAO,IAAI,CAAA;;;;SAIH,SAAS,CAAC,OAAO,IAAI,OAAO;aACxB,SAAS,CAAC,MAAM,IAAI,OAAO;gBACxB,SAAS,CAAC,QAAQ;gBAClB,SAAS,CAAC,QAAQ;gBAClB,SAAS,CAAC,QAAQ;iBACjB,SAAS,CAAC,eAAe,IAAI,OAAO;cACvC,SAAS,CAAC,kBAAkB;;;;;YAK9B,SAAS,CAAC,IAAI;YACd,SAAS,CAAC,YAAY,EAAE;wBACZ,SAAS,CAAC,sBAAsB,EAAE,IAAI,OAAO;iBACpD,SAAS,CAAC,QAAQ;cACrB,SAAS,CAAC,aAAa;;;iBAGpB,QAAQ,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC;MACzE,SAAS,CAAC,WAAW,EAAE;;KAExB,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;;;;aAIP,UAAU;;aAEV,SAAS,CAAC,EAAE,CAAC,oCAAoC,CAAC;kBAC7C,SAAS,CAAC,QAAQ;eACrB,SAAS,CAAC,YAAY;;;IAGjC,CAAC,CAAC,CAAC,OAAO;KACT,oBAAoB,CAAC,SAAS,CAAC;;EAElC,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"file-field.template.js","sourceRoot":"","sources":["../../../../src/components/inputs/file-field/file-field.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,gCAAgC,CAAC;AACxC,OAAO,0CAA0C,CAAC;AAClD,OAAO,4BAA4B,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,2EAA2E;AAC3E,MAAM,YAAY,GAA2B;IAC5C,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE,eAAe;IACnB,QAAQ,EAAE,eAAe;IACzB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,UAAU;IACf,GA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,CAAC,kBAAkB;;KAErC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC;oDACb,SAAS,CAAC,UAAU;QACpE,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC;QAChD,CAAC,CAAC,SAAS,CAAC,aAAa;;EAE3B,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** Splits a name at its last dot. A leading dot (".env") is no extension. */
2
+ export declare function splitName(name: string): [string, string];
3
+ /** The split of the first render, done by CSS: a start that is cut short when it
4
+ * does not fit, and an end, the last characters and the extension, that stays. */
5
+ export declare function splitForTruncation(name: string): [string, string];
6
+ /**
7
+ * The name as it fits `width`, measured with `measure`: whole when it fits,
8
+ * otherwise as many characters as fit, half from the start and half from the
9
+ * end, around an ellipsis and before the extension.
10
+ */
11
+ export declare function truncateMiddle(name: string, width: number, measure: (text: string) => number): {
12
+ text: string;
13
+ truncated: boolean;
14
+ };
15
+ /** Measures text the way `container` renders it, with a hidden span in it.
16
+ * Canvas text metrics drift from the page by a character or two (kerning,
17
+ * font features), which shows as a second, CSS ellipsis. Call `done` after. */
18
+ export declare function textMeasurer(container: Element): {
19
+ measure: (text: string) => number;
20
+ done: () => void;
21
+ };
22
+ //# sourceMappingURL=file-field.truncate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-field.truncate.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/file-field/file-field.truncate.ts"],"names":[],"mappings":"AAQA,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAGxD;AAMD;mFACmF;AACnF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAIjE;AAQD;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAWtC;AAED;;gFAEgF;AAChF,wBAAgB,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG;IAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,CAAA;CAAE,CAWxG"}
@@ -0,0 +1,62 @@
1
+ /* Cutting a file name short in the middle, as Finder does: the start and the end
2
+ * of a name tell files apart ("Screenshot … 15.42.11.png", "rapport-v3.pdf"),
3
+ * so the characters that fit are shared evenly between the two, and the
4
+ * extension always stays. CSS can only cut at the start or the end, so this
5
+ * measures the text against the width it has. */
6
+ const ELLIPSIS = '…';
7
+ /** Splits a name at its last dot. A leading dot (".env") is no extension. */
8
+ export function splitName(name) {
9
+ const dot = name.lastIndexOf('.');
10
+ return dot > 0 ? [name.slice(0, dot), name.slice(dot)] : [name, ''];
11
+ }
12
+ /** Characters of the name kept in view before the extension in the first
13
+ * render, before anything is measured. */
14
+ const NAME_END_LENGTH = 8;
15
+ /** The split of the first render, done by CSS: a start that is cut short when it
16
+ * does not fit, and an end, the last characters and the extension, that stays. */
17
+ export function splitForTruncation(name) {
18
+ const [base, extension] = splitName(name);
19
+ const cut = Math.max(0, base.length - NAME_END_LENGTH);
20
+ return [base.slice(0, cut), base.slice(cut) + extension];
21
+ }
22
+ function compose(base, extension, kept) {
23
+ const start = base.slice(0, Math.ceil(kept / 2)).trimEnd();
24
+ const end = base.slice(base.length - Math.floor(kept / 2)).trimStart();
25
+ return `${start}${ELLIPSIS}${end}${extension}`;
26
+ }
27
+ /**
28
+ * The name as it fits `width`, measured with `measure`: whole when it fits,
29
+ * otherwise as many characters as fit, half from the start and half from the
30
+ * end, around an ellipsis and before the extension.
31
+ */
32
+ export function truncateMiddle(name, width, measure) {
33
+ if (measure(name) <= width)
34
+ return { text: name, truncated: false };
35
+ const [base, extension] = splitName(name);
36
+ let low = 0;
37
+ let high = base.length - 1;
38
+ while (low < high) {
39
+ const mid = Math.ceil((low + high) / 2);
40
+ if (measure(compose(base, extension, mid)) <= width)
41
+ low = mid;
42
+ else
43
+ high = mid - 1;
44
+ }
45
+ return { text: compose(base, extension, low), truncated: true };
46
+ }
47
+ /** Measures text the way `container` renders it, with a hidden span in it.
48
+ * Canvas text metrics drift from the page by a character or two (kerning,
49
+ * font features), which shows as a second, CSS ellipsis. Call `done` after. */
50
+ export function textMeasurer(container) {
51
+ const probe = document.createElement('span');
52
+ probe.style.cssText = 'position: absolute; visibility: hidden; white-space: pre;';
53
+ container.append(probe);
54
+ return {
55
+ measure: (text) => {
56
+ probe.textContent = text;
57
+ return probe.getBoundingClientRect().width;
58
+ },
59
+ done: () => probe.remove(),
60
+ };
61
+ }
62
+ //# sourceMappingURL=file-field.truncate.js.map