@igne-agency/react-web-ui 0.3.1 → 0.4.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 (290) hide show
  1. package/README.md +32 -1
  2. package/dist/components/accordion/accordion.css +24 -19
  3. package/dist/components/accordion/accordion.d.ts +19 -3
  4. package/dist/components/accordion/accordion.js +86 -32
  5. package/dist/components/accordion/accordion.module.js +8 -8
  6. package/dist/components/active-filters/active-filter-describers.d.ts +1 -1
  7. package/dist/components/active-filters/active-filter-describers.js +1 -1
  8. package/dist/components/active-filters/active-filters.d.ts +35 -2
  9. package/dist/components/active-filters/active-filters.js +57 -52
  10. package/dist/components/active-filters/index.js +2 -2
  11. package/dist/components/attachment-tile/attachment-preview.d.ts +11 -9
  12. package/dist/components/attachment-tile/attachment-preview.js +102 -68
  13. package/dist/components/attachment-tile/attachment-tile.css +22 -13
  14. package/dist/components/attachment-tile/attachment-tile.d.ts +51 -6
  15. package/dist/components/attachment-tile/attachment-tile.js +209 -85
  16. package/dist/components/attachment-tile/attachment-tile.module.js +10 -10
  17. package/dist/components/attachment-tile/index.d.ts +1 -1
  18. package/dist/components/attachment-tile/index.js +2 -2
  19. package/dist/components/avatar/avatar.d.ts +5 -5
  20. package/dist/components/avatar/avatar.js +64 -37
  21. package/dist/components/avatar-group/avatar-group.js +2 -2
  22. package/dist/components/badge/badge.js +1 -1
  23. package/dist/components/breadcrumbs/breadcrumbs.d.ts +22 -7
  24. package/dist/components/breadcrumbs/breadcrumbs.js +189 -170
  25. package/dist/components/button/button.d.ts +2 -3
  26. package/dist/components/button/button.js +58 -77
  27. package/dist/components/button/close-button.d.ts +4 -2
  28. package/dist/components/button/close-button.js +9 -9
  29. package/dist/components/checkbox-field/checkbox-field.d.ts +17 -3
  30. package/dist/components/checkbox-field/checkbox-field.js +108 -131
  31. package/dist/components/checkbox-field/checkbox.css +26 -34
  32. package/dist/components/checkbox-field/checkbox.d.ts +51 -8
  33. package/dist/components/checkbox-field/checkbox.js +221 -57
  34. package/dist/components/checkbox-field/checkbox.module.js +6 -8
  35. package/dist/components/checkbox-field/index.d.ts +0 -1
  36. package/dist/components/checkbox-field/index.js +1 -2
  37. package/dist/components/checkbox-field/tsf-checkbox-field.d.ts +2 -2
  38. package/dist/components/checkbox-group-field/checkbox-group-field.d.ts +4 -1
  39. package/dist/components/checkbox-group-field/checkbox-group-field.js +54 -50
  40. package/dist/components/checkbox-group-field/checkbox-group.d.ts +7 -2
  41. package/dist/components/checkbox-group-field/checkbox-group.js +8 -3
  42. package/dist/components/collapsible/collapsible.css +23 -18
  43. package/dist/components/collapsible/collapsible.d.ts +18 -3
  44. package/dist/components/collapsible/collapsible.js +85 -32
  45. package/dist/components/collapsible/collapsible.module.js +7 -7
  46. package/dist/components/combobox-field/combobox-field.d.ts +9 -1
  47. package/dist/components/combobox-field/combobox-field.js +195 -175
  48. package/dist/components/combobox-field/combobox-items.d.ts +2 -2
  49. package/dist/components/combobox-field/combobox-items.js +4 -4
  50. package/dist/components/combobox-field/combobox.css +99 -96
  51. package/dist/components/combobox-field/combobox.d.ts +94 -15
  52. package/dist/components/combobox-field/combobox.js +484 -159
  53. package/dist/components/combobox-field/combobox.module.js +21 -21
  54. package/dist/components/combobox-field/index.d.ts +0 -1
  55. package/dist/components/combobox-field/selection.d.ts +4 -1
  56. package/dist/components/combobox-field/value-state-view.css +7 -3
  57. package/dist/components/combobox-field/value-state-view.d.ts +4 -2
  58. package/dist/components/combobox-field/value-state-view.js +15 -15
  59. package/dist/components/combobox-field/value-state-view.module.js +6 -4
  60. package/dist/components/composer/composer-attachments.d.ts +11 -3
  61. package/dist/components/composer/composer-attachments.js +61 -47
  62. package/dist/components/composer/composer-editor.d.ts +2 -1
  63. package/dist/components/composer/composer-editor.js +79 -71
  64. package/dist/components/composer/composer-mentions.js +2 -2
  65. package/dist/components/composer/composer.d.ts +42 -21
  66. package/dist/components/composer/composer.js +201 -58
  67. package/dist/components/composer/mention-text.js +3 -3
  68. package/dist/components/confirm-dialog/confirm-dialog.d.ts +8 -7
  69. package/dist/components/confirm-dialog/confirm-dialog.js +10 -9
  70. package/dist/components/conversation/conversation.context.d.ts +0 -5
  71. package/dist/components/conversation/conversation.d.ts +63 -29
  72. package/dist/components/conversation/conversation.js +193 -82
  73. package/dist/components/conversation/index.d.ts +1 -1
  74. package/dist/components/date-field/date-field.d.ts +10 -4
  75. package/dist/components/date-field/date-field.js +57 -43
  76. package/dist/components/date-field/date-input.d.ts +20 -3
  77. package/dist/components/date-field/date-input.js +28 -13
  78. package/dist/components/date-field/index.d.ts +1 -1
  79. package/dist/components/date-field/tsf-date-field.d.ts +1 -1
  80. package/dist/components/date-field/tsf-date-field.js +1 -1
  81. package/dist/components/date-range-field/date-range-field.d.ts +8 -4
  82. package/dist/components/date-range-field/date-range-field.js +57 -45
  83. package/dist/components/date-range-field/date-range-input.d.ts +20 -3
  84. package/dist/components/date-range-field/date-range-input.js +27 -12
  85. package/dist/components/date-range-field/tsf-date-range-field.d.ts +1 -1
  86. package/dist/components/date-range-field/tsf-date-range-field.js +1 -1
  87. package/dist/components/detail-list/detail-list.d.ts +28 -27
  88. package/dist/components/detail-list/detail-list.js +177 -121
  89. package/dist/components/dialog/dialog.d.ts +47 -27
  90. package/dist/components/dialog/dialog.js +101 -38
  91. package/dist/components/divider/divider.js +1 -1
  92. package/dist/components/drawer/drawer.d.ts +48 -30
  93. package/dist/components/drawer/drawer.js +113 -41
  94. package/dist/components/email-field/email-field.d.ts +5 -3
  95. package/dist/components/email-field/email-field.js +1 -3
  96. package/dist/components/email-field/tsf-email-field.d.ts +3 -2
  97. package/dist/components/empty-message/empty-message.d.ts +3 -3
  98. package/dist/components/empty-message/empty-message.js +3 -3
  99. package/dist/components/error-boundary/error-boundary.d.ts +5 -2
  100. package/dist/components/error-boundary/error-boundary.js +2 -3
  101. package/dist/components/error-message/error-message.d.ts +1 -1
  102. package/dist/components/error-message/error-message.js +1 -1
  103. package/dist/components/error-text/error-text.js +3 -3
  104. package/dist/components/field/field.d.ts +5 -5
  105. package/dist/components/field/field.js +9 -9
  106. package/dist/components/field/index.js +2 -2
  107. package/dist/components/field/input-parts.js +1 -1
  108. package/dist/components/field-placeholder/field-placeholder.d.ts +4 -1
  109. package/dist/components/field-placeholder/field-placeholder.js +41 -26
  110. package/dist/components/fieldset/field-group.js +1 -1
  111. package/dist/components/fieldset/fieldset-root.js +1 -1
  112. package/dist/components/fieldset/fieldset.js +1 -1
  113. package/dist/components/file-field/file-field.css +19 -15
  114. package/dist/components/file-field/file-field.d.ts +10 -1
  115. package/dist/components/file-field/file-field.js +130 -109
  116. package/dist/components/file-field/file-field.module.js +6 -4
  117. package/dist/components/file-field/file-input.d.ts +32 -9
  118. package/dist/components/file-field/file-input.js +94 -74
  119. package/dist/components/filter-bar/filter-bar.d.ts +79 -51
  120. package/dist/components/filter-bar/filter-bar.js +552 -216
  121. package/dist/components/form/form.d.ts +4 -6
  122. package/dist/components/form/form.js +6 -8
  123. package/dist/components/icon/icon.d.ts +5 -10
  124. package/dist/components/icon/icon.js +4 -6
  125. package/dist/components/link/link.js +1 -1
  126. package/dist/components/link-button/link-button.d.ts +1 -2
  127. package/dist/components/link-button/link-button.js +12 -22
  128. package/dist/components/loading-message/loading-message.d.ts +2 -2
  129. package/dist/components/loading-message/loading-message.js +1 -1
  130. package/dist/components/locale-provider/locale-provider.js +1 -1
  131. package/dist/components/menu/menu.d.ts +40 -22
  132. package/dist/components/menu/menu.js +100 -40
  133. package/dist/components/nav/nav-context.d.ts +0 -1
  134. package/dist/components/nav/nav-context.js +1 -2
  135. package/dist/components/nav/nav-item-view.d.ts +7 -7
  136. package/dist/components/nav/nav-item-view.js +27 -51
  137. package/dist/components/nav/nav.css +72 -60
  138. package/dist/components/nav/nav.d.ts +15 -8
  139. package/dist/components/nav/nav.js +105 -52
  140. package/dist/components/nav/nav.module.js +14 -14
  141. package/dist/components/number-field/number-field.d.ts +7 -1
  142. package/dist/components/number-field/number-field.js +98 -82
  143. package/dist/components/number-field/number-input.d.ts +53 -4
  144. package/dist/components/number-field/number-input.js +68 -21
  145. package/dist/components/number-field/tsf-number-field.d.ts +1 -1
  146. package/dist/components/number-field/tsf-number-field.js +1 -1
  147. package/dist/components/otp-field/otp-input.d.ts +25 -0
  148. package/dist/components/otp-field/otp-input.js +26 -1
  149. package/dist/components/pagination/pagination.d.ts +82 -23
  150. package/dist/components/pagination/pagination.js +656 -229
  151. package/dist/components/password-field/password-field.d.ts +7 -1
  152. package/dist/components/password-field/password-field.js +117 -126
  153. package/dist/components/password-field/password-strength.js +1 -1
  154. package/dist/components/password-field/tsf-password-field.d.ts +1 -1
  155. package/dist/components/password-field/tsf-password-field.js +1 -1
  156. package/dist/components/photo-field/photo-field.d.ts +17 -3
  157. package/dist/components/photo-field/photo-field.js +168 -89
  158. package/dist/components/photo-field/photo-input-context.d.ts +25 -0
  159. package/dist/components/photo-field/photo-input-context.js +14 -0
  160. package/dist/components/photo-field/photo-input.d.ts +58 -23
  161. package/dist/components/photo-field/photo-input.js +459 -261
  162. package/dist/components/popover/popover.d.ts +55 -23
  163. package/dist/components/popover/popover.js +205 -61
  164. package/dist/components/radio-group-field/radio-group.js +1 -1
  165. package/dist/components/search-field/search-field.d.ts +7 -5
  166. package/dist/components/search-field/search-field.js +4 -6
  167. package/dist/components/search-field/tsf-search-field.d.ts +1 -1
  168. package/dist/components/search-field/tsf-search-field.js +1 -1
  169. package/dist/components/segmented-control-field/segmented-control.js +1 -1
  170. package/dist/components/select-field/select-field.d.ts +7 -1
  171. package/dist/components/select-field/select-field.js +151 -139
  172. package/dist/components/select-field/select.d.ts +28 -6
  173. package/dist/components/select-field/select.js +234 -149
  174. package/dist/components/skeleton/skeleton.js +1 -1
  175. package/dist/components/spinner/spinner.css +47 -1
  176. package/dist/components/spinner/spinner.js +28 -11
  177. package/dist/components/spinner/spinner.module.js +18 -3
  178. package/dist/components/stale/stale.d.ts +17 -21
  179. package/dist/components/stale/stale.js +307 -129
  180. package/dist/components/status-message/status-message.css +22 -21
  181. package/dist/components/status-message/status-message.d.ts +10 -5
  182. package/dist/components/status-message/status-message.js +20 -24
  183. package/dist/components/status-message/status-message.module.js +6 -6
  184. package/dist/components/status-message/status-preset.d.ts +4 -5
  185. package/dist/components/status-message/status-preset.js +3 -3
  186. package/dist/components/switch-field/switch.js +1 -1
  187. package/dist/components/tabs/tabs.d.ts +51 -28
  188. package/dist/components/tabs/tabs.js +219 -144
  189. package/dist/components/tag/tag.css +23 -21
  190. package/dist/components/tag/tag.d.ts +17 -15
  191. package/dist/components/tag/tag.js +140 -65
  192. package/dist/components/tag/tag.module.js +3 -3
  193. package/dist/components/tag-group/tag-group.css +30 -27
  194. package/dist/components/tag-group/tag-group.d.ts +10 -4
  195. package/dist/components/tag-group/tag-group.js +47 -35
  196. package/dist/components/tag-group/tag-group.module.js +4 -4
  197. package/dist/components/text-field/text-field.d.ts +14 -3
  198. package/dist/components/text-field/text-field.js +154 -133
  199. package/dist/components/text-field/text-input.d.ts +89 -3
  200. package/dist/components/text-field/text-input.js +184 -70
  201. package/dist/components/textarea-field/textarea.js +1 -1
  202. package/dist/components/time-field/time-input.d.ts +6 -0
  203. package/dist/components/time-field/time-input.js +6 -0
  204. package/dist/components/time-zone-provider/time-zone-provider.js +1 -1
  205. package/dist/components/toast/index.js +2 -2
  206. package/dist/components/toast/toast-provider.css +38 -34
  207. package/dist/components/toast/toast-provider.d.ts +65 -3
  208. package/dist/components/toast/toast-provider.js +313 -148
  209. package/dist/components/toast/toast-provider.module.js +11 -17
  210. package/dist/components/toast/toast.d.ts +5 -1
  211. package/dist/components/toast/toast.js +2 -1
  212. package/dist/components/toggle-group-field/toggle-group.js +1 -1
  213. package/dist/components/tooltip/tooltip.d.ts +6 -6
  214. package/dist/components/tooltip/tooltip.js +7 -7
  215. package/dist/data-table/data-table-content.d.ts +18 -10
  216. package/dist/data-table/data-table-content.js +145 -290
  217. package/dist/data-table/data-table-context.d.ts +4 -2
  218. package/dist/data-table/data-table-context.js +1 -1
  219. package/dist/data-table/data-table-parts.d.ts +99 -0
  220. package/dist/data-table/data-table-parts.js +1182 -0
  221. package/dist/data-table/data-table-selection.d.ts +7 -3
  222. package/dist/data-table/data-table-selection.js +62 -37
  223. package/dist/data-table/data-table.css +100 -95
  224. package/dist/data-table/data-table.d.ts +49 -25
  225. package/dist/data-table/data-table.js +95 -83
  226. package/dist/data-table/data-table.module.js +34 -34
  227. package/dist/data-table/index.d.ts +2 -1
  228. package/dist/data-table/index.js +2 -1
  229. package/dist/data-view/use-data-view.d.ts +2 -2
  230. package/dist/data-view/use-data-view.js +2 -2
  231. package/dist/index.js +7 -8
  232. package/dist/lib/calendar/calendar-navigation.d.ts +9 -2
  233. package/dist/lib/calendar/calendar-navigation.js +72 -73
  234. package/dist/lib/calendar/calendar-year.d.ts +4 -3
  235. package/dist/lib/calendar/calendar-year.js +137 -156
  236. package/dist/lib/calendar/temporal.d.ts +18 -12
  237. package/dist/lib/calendar/temporal.js +191 -147
  238. package/dist/lib/table-storage.d.ts +2 -2
  239. package/dist/lib/table-storage.js +2 -2
  240. package/dist/lib/unsaved-changes/leave-guard.js +1 -1
  241. package/dist/terrazzo/index.d.ts +16 -0
  242. package/dist/terrazzo/index.js +94 -2
  243. package/dist/tokens.css +71 -69
  244. package/package.json +3 -2
  245. package/tokens/ref.tokens.json +0 -30
  246. package/tokens/sys.tokens.json +0 -7
  247. package/dist/assets/spinner.js +0 -28
  248. package/dist/components/checkbox-field/checkbox-glyph.d.ts +0 -12
  249. package/dist/components/checkbox-field/checkbox-glyph.js +0 -38
  250. package/dist/components/combobox-field/combobox-popup-body.d.ts +0 -34
  251. package/dist/components/combobox-field/combobox-popup-body.js +0 -142
  252. package/dist/components/conversation/conversation.context.js +0 -4
  253. package/dist/vendor/@material-design-icons/svg/outlined/add.js +0 -12
  254. package/dist/vendor/@material-design-icons/svg/outlined/arrow_downward.js +0 -12
  255. package/dist/vendor/@material-design-icons/svg/outlined/arrow_forward.js +0 -12
  256. package/dist/vendor/@material-design-icons/svg/outlined/arrow_upward.js +0 -12
  257. package/dist/vendor/@material-design-icons/svg/outlined/attach_file.js +0 -12
  258. package/dist/vendor/@material-design-icons/svg/outlined/block.js +0 -12
  259. package/dist/vendor/@material-design-icons/svg/outlined/calendar_today.js +0 -12
  260. package/dist/vendor/@material-design-icons/svg/outlined/check.js +0 -12
  261. package/dist/vendor/@material-design-icons/svg/outlined/check_circle.js +0 -12
  262. package/dist/vendor/@material-design-icons/svg/outlined/chevron_left.js +0 -12
  263. package/dist/vendor/@material-design-icons/svg/outlined/chevron_right.js +0 -12
  264. package/dist/vendor/@material-design-icons/svg/outlined/close.js +0 -12
  265. package/dist/vendor/@material-design-icons/svg/outlined/content_copy.js +0 -12
  266. package/dist/vendor/@material-design-icons/svg/outlined/date_range.js +0 -12
  267. package/dist/vendor/@material-design-icons/svg/outlined/description.js +0 -12
  268. package/dist/vendor/@material-design-icons/svg/outlined/download.js +0 -12
  269. package/dist/vendor/@material-design-icons/svg/outlined/error.js +0 -12
  270. package/dist/vendor/@material-design-icons/svg/outlined/error_outline.js +0 -12
  271. package/dist/vendor/@material-design-icons/svg/outlined/expand_less.js +0 -12
  272. package/dist/vendor/@material-design-icons/svg/outlined/expand_more.js +0 -12
  273. package/dist/vendor/@material-design-icons/svg/outlined/filter_alt.js +0 -12
  274. package/dist/vendor/@material-design-icons/svg/outlined/filter_alt_off.js +0 -12
  275. package/dist/vendor/@material-design-icons/svg/outlined/first_page.js +0 -12
  276. package/dist/vendor/@material-design-icons/svg/outlined/info.js +0 -12
  277. package/dist/vendor/@material-design-icons/svg/outlined/keyboard_arrow_down.js +0 -12
  278. package/dist/vendor/@material-design-icons/svg/outlined/last_page.js +0 -12
  279. package/dist/vendor/@material-design-icons/svg/outlined/mail.js +0 -12
  280. package/dist/vendor/@material-design-icons/svg/outlined/more_horiz.js +0 -12
  281. package/dist/vendor/@material-design-icons/svg/outlined/photo_camera.js +0 -12
  282. package/dist/vendor/@material-design-icons/svg/outlined/remove.js +0 -12
  283. package/dist/vendor/@material-design-icons/svg/outlined/restart_alt.js +0 -12
  284. package/dist/vendor/@material-design-icons/svg/outlined/restore.js +0 -12
  285. package/dist/vendor/@material-design-icons/svg/outlined/search.js +0 -12
  286. package/dist/vendor/@material-design-icons/svg/outlined/unfold_more.js +0 -12
  287. package/dist/vendor/@material-design-icons/svg/outlined/upload_file.js +0 -12
  288. package/dist/vendor/@material-design-icons/svg/outlined/visibility.js +0 -12
  289. package/dist/vendor/@material-design-icons/svg/outlined/visibility_off.js +0 -12
  290. package/dist/vendor/@material-design-icons/svg/outlined/warning_amber.js +0 -12
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from "react";
1
+ import { type ComponentPropsWithRef, type ReactNode } from "react";
2
2
  /** An image source for a preview, and whether one is still on its way. */
3
3
  export type AttachmentPreviewSource = Readonly<{
4
4
  src: string | undefined;
@@ -12,22 +12,24 @@ export type AttachmentPreviewSource = Readonly<{
12
12
  * useAttachmentPreview(file); // -> { src: "data:image/png;base64,…", pending: false }
13
13
  */
14
14
  export declare const useAttachmentPreview: (blob: Blob | undefined) => AttachmentPreviewSource;
15
- export type AttachmentPreviewProps = Readonly<{
15
+ export type AttachmentPreviewProps = Omit<ComponentPropsWithRef<"span">, "children"> & Readonly<{
16
16
  name: string;
17
17
  /** Tooltip text for the preview. */
18
18
  hint: string;
19
- /** Image source; without one the tile shows a glyph and the extension. */
19
+ /** Image source; without one the tile shows its `icon` and the file's extension. */
20
20
  src: string | undefined;
21
21
  /** Whether an image source is still being produced. */
22
22
  pending?: boolean;
23
+ /** A file-type glyph above the extension, where there is no image. */
24
+ icon?: ReactNode;
23
25
  }>;
24
26
  /**
25
- * The inside of an attachment tile: an image preview where there is one, a file
26
- * glyph and the extension otherwise, plus the file name for assistive tech. A
27
- * source that is still arriving shows a skeleton; one that fails to load falls
28
- * back to the glyph.
27
+ * The inside of an attachment tile: an image preview where there is one, the
28
+ * `icon` and the file's extension otherwise, plus the file name for assistive
29
+ * tech. A source that is still arriving shows a skeleton; one that fails to
30
+ * load falls back to the extension.
29
31
  *
30
32
  * @example
31
- * <AttachmentPreview name="nota.pdf" hint="nota.pdf (12 kB)" src={undefined} />
33
+ * <AttachmentTile.Preview name="nota.pdf" hint="nota.pdf (12 kB)" src={undefined} />
32
34
  */
33
- export declare const AttachmentPreview: ({ name, hint, src, pending, }: AttachmentPreviewProps) => ReactNode;
35
+ export declare const AttachmentPreview: ({ name, hint, src, pending, icon, className, ...props }: AttachmentPreviewProps) => ReactNode;
@@ -1,12 +1,11 @@
1
- import SvgDescription from "../../vendor/@material-design-icons/svg/outlined/description.js";
2
1
  import { useBusyPhase } from "../../lib/hooks/use-busy-phase.js";
3
- import { Icon } from "../icon/icon.js";
4
2
  import { Skeleton } from "../skeleton/skeleton.js";
5
3
  import { Tooltip } from "../tooltip/tooltip.js";
6
4
  import attachment_tile_module_default from "./attachment-tile.module.js";
7
5
  import { c } from "react/compiler-runtime";
6
+ import { clsx } from "clsx";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { useEffect, useState } from "react";
9
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
9
  // src/components/attachment-tile/attachment-preview.tsx
11
10
  var extensionOf = (name) => {
12
11
  const dot = name.lastIndexOf(".");
@@ -66,38 +65,63 @@ var useAttachmentPreview = (blob) => {
66
65
  return t3;
67
66
  };
68
67
  /**
69
- * The inside of an attachment tile: an image preview where there is one, a file
70
- * glyph and the extension otherwise, plus the file name for assistive tech. A
71
- * source that is still arriving shows a skeleton; one that fails to load falls
72
- * back to the glyph.
68
+ * The inside of an attachment tile: an image preview where there is one, the
69
+ * `icon` and the file's extension otherwise, plus the file name for assistive
70
+ * tech. A source that is still arriving shows a skeleton; one that fails to
71
+ * load falls back to the extension.
73
72
  *
74
73
  * @example
75
- * <AttachmentPreview name="nota.pdf" hint="nota.pdf (12 kB)" src={undefined} />
74
+ * <AttachmentTile.Preview name="nota.pdf" hint="nota.pdf (12 kB)" src={undefined} />
76
75
  */
77
76
  var AttachmentPreview = (t0) => {
78
- const $ = c(23);
79
- const { name, hint, src, pending: t1 } = t0;
77
+ const $ = c(36);
78
+ let className;
79
+ let hint;
80
+ let icon;
81
+ let name;
82
+ let props;
83
+ let src;
84
+ let t1;
85
+ if ($[0] !== t0) {
86
+ ({name, hint, src, pending: t1, icon, className, ...props} = t0);
87
+ $[0] = t0;
88
+ $[1] = className;
89
+ $[2] = hint;
90
+ $[3] = icon;
91
+ $[4] = name;
92
+ $[5] = props;
93
+ $[6] = src;
94
+ $[7] = t1;
95
+ } else {
96
+ className = $[1];
97
+ hint = $[2];
98
+ icon = $[3];
99
+ name = $[4];
100
+ props = $[5];
101
+ src = $[6];
102
+ t1 = $[7];
103
+ }
80
104
  const pending = t1 === void 0 ? false : t1;
81
105
  const [loadedSrc, setLoadedSrc] = useState();
82
106
  const [brokenSrc, setBrokenSrc] = useState();
83
107
  let t2;
84
- if ($[0] !== name) {
108
+ if ($[8] !== name) {
85
109
  t2 = extensionOf(name);
86
- $[0] = name;
87
- $[1] = t2;
88
- } else t2 = $[1];
110
+ $[8] = name;
111
+ $[9] = t2;
112
+ } else t2 = $[9];
89
113
  const extension = t2;
90
114
  const image = src === brokenSrc ? void 0 : src;
91
115
  const t3 = pending || image !== void 0 && image !== loadedSrc;
92
116
  let t4;
93
- if ($[2] !== t3) {
117
+ if ($[10] !== t3) {
94
118
  t4 = { busy: t3 };
95
- $[2] = t3;
96
- $[3] = t4;
97
- } else t4 = $[3];
119
+ $[10] = t3;
120
+ $[11] = t4;
121
+ } else t4 = $[11];
98
122
  const busy = useBusyPhase(t4) !== "fresh";
99
123
  let t5;
100
- if ($[4] !== image) {
124
+ if ($[12] !== image) {
101
125
  t5 = (node) => {
102
126
  if (image === void 0 || !node?.complete) return;
103
127
  if (node.naturalWidth === 0) {
@@ -106,17 +130,23 @@ var AttachmentPreview = (t0) => {
106
130
  }
107
131
  setLoadedSrc(image);
108
132
  };
109
- $[4] = image;
110
- $[5] = t5;
111
- } else t5 = $[5];
133
+ $[12] = image;
134
+ $[13] = t5;
135
+ } else t5 = $[13];
112
136
  const settleAlreadyDecoded = t5;
113
- const t6 = busy || void 0;
114
- let t7;
115
- if ($[6] !== extension || $[7] !== image || $[8] !== pending || $[9] !== settleAlreadyDecoded) {
116
- t7 = image === void 0 ? pending ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Icon, {
117
- svg: SvgDescription,
118
- size: 1.5,
119
- label: ""
137
+ let t6;
138
+ if ($[14] !== className) {
139
+ t6 = clsx(attachment_tile_module_default.preview, className);
140
+ $[14] = className;
141
+ $[15] = t6;
142
+ } else t6 = $[15];
143
+ const t7 = busy || void 0;
144
+ let t8;
145
+ if ($[16] !== extension || $[17] !== icon || $[18] !== image || $[19] !== pending || $[20] !== settleAlreadyDecoded) {
146
+ t8 = image === void 0 ? pending ? null : /* @__PURE__ */ jsxs(Fragment, { children: [icon === void 0 ? null : /* @__PURE__ */ jsx("span", {
147
+ "aria-hidden": "true",
148
+ className: attachment_tile_module_default.icon,
149
+ children: icon
120
150
  }), extension === "" ? null : /* @__PURE__ */ jsx("span", {
121
151
  className: attachment_tile_module_default.extension,
122
152
  children: extension
@@ -128,54 +158,58 @@ var AttachmentPreview = (t0) => {
128
158
  onLoad: () => setLoadedSrc(image),
129
159
  onError: () => setBrokenSrc(image)
130
160
  });
131
- $[6] = extension;
132
- $[7] = image;
133
- $[8] = pending;
134
- $[9] = settleAlreadyDecoded;
135
- $[10] = t7;
136
- } else t7 = $[10];
137
- let t8;
138
- if ($[11] !== busy) {
139
- t8 = busy ? /* @__PURE__ */ jsx(Skeleton, { className: attachment_tile_module_default.imageSkeleton }) : null;
140
- $[11] = busy;
141
- $[12] = t8;
142
- } else t8 = $[12];
161
+ $[16] = extension;
162
+ $[17] = icon;
163
+ $[18] = image;
164
+ $[19] = pending;
165
+ $[20] = settleAlreadyDecoded;
166
+ $[21] = t8;
167
+ } else t8 = $[21];
143
168
  let t9;
144
- if ($[13] !== name) {
145
- t9 = /* @__PURE__ */ jsx("span", {
169
+ if ($[22] !== busy) {
170
+ t9 = busy ? /* @__PURE__ */ jsx(Skeleton, { className: attachment_tile_module_default.imageSkeleton }) : null;
171
+ $[22] = busy;
172
+ $[23] = t9;
173
+ } else t9 = $[23];
174
+ let t10;
175
+ if ($[24] !== name) {
176
+ t10 = /* @__PURE__ */ jsx("span", {
146
177
  className: attachment_tile_module_default.name,
147
178
  children: name
148
179
  });
149
- $[13] = name;
150
- $[14] = t9;
151
- } else t9 = $[14];
152
- let t10;
153
- if ($[15] !== t6 || $[16] !== t7 || $[17] !== t8 || $[18] !== t9) {
154
- t10 = /* @__PURE__ */ jsxs("span", {
155
- className: attachment_tile_module_default.preview,
156
- "aria-busy": t6,
180
+ $[24] = name;
181
+ $[25] = t10;
182
+ } else t10 = $[25];
183
+ let t11;
184
+ if ($[26] !== props || $[27] !== t10 || $[28] !== t6 || $[29] !== t7 || $[30] !== t8 || $[31] !== t9) {
185
+ t11 = /* @__PURE__ */ jsxs("span", {
186
+ ...props,
187
+ className: t6,
188
+ "aria-busy": t7,
157
189
  children: [
158
- t7,
159
190
  t8,
160
- t9
191
+ t9,
192
+ t10
161
193
  ]
162
194
  });
163
- $[15] = t6;
164
- $[16] = t7;
165
- $[17] = t8;
166
- $[18] = t9;
167
- $[19] = t10;
168
- } else t10 = $[19];
169
- let t11;
170
- if ($[20] !== hint || $[21] !== t10) {
171
- t11 = /* @__PURE__ */ jsx(Tooltip, {
195
+ $[26] = props;
196
+ $[27] = t10;
197
+ $[28] = t6;
198
+ $[29] = t7;
199
+ $[30] = t8;
200
+ $[31] = t9;
201
+ $[32] = t11;
202
+ } else t11 = $[32];
203
+ let t12;
204
+ if ($[33] !== hint || $[34] !== t11) {
205
+ t12 = /* @__PURE__ */ jsx(Tooltip, {
172
206
  content: hint,
173
- children: t10
207
+ children: t11
174
208
  });
175
- $[20] = hint;
176
- $[21] = t10;
177
- $[22] = t11;
178
- } else t11 = $[22];
179
- return t11;
209
+ $[33] = hint;
210
+ $[34] = t11;
211
+ $[35] = t12;
212
+ } else t12 = $[35];
213
+ return t12;
180
214
  };
181
215
  export { AttachmentPreview, useAttachmentPreview };
@@ -1,6 +1,6 @@
1
1
  @layer kit.reset, kit.base, kit.components;
2
2
  @layer kit.components {
3
- ._tile_1v5fo_3 {
3
+ ._tile_gqsrq_3 {
4
4
  --_tile-size: var(--attachment-tile-size, 5rem);
5
5
  --_tile-border-width: 1px;
6
6
  --_tile-radius: var(
@@ -20,32 +20,32 @@
20
20
  color: var(--attachment-tile-fg, var(--sys-color-text-muted));
21
21
  cursor: default;
22
22
  }
23
- ._tile_1v5fo_3 {
23
+ ._tile_gqsrq_3 {
24
24
  outline: 0 solid var(--sys-color-focus-ring);
25
25
  outline-offset: var(--sys-focus-ring-offset);
26
26
  }
27
- ._tile_1v5fo_3:focus-visible {
27
+ ._tile_gqsrq_3:focus-visible {
28
28
  outline-width: var(--sys-focus-ring-width);
29
29
  }
30
- ._tile_1v5fo_3[data-focus-visible] {
30
+ ._tile_gqsrq_3[data-focus-visible] {
31
31
  outline-width: var(--sys-focus-ring-width);
32
32
  }
33
- ._tile_1v5fo_3[data-invalid] {
33
+ ._tile_gqsrq_3[data-invalid] {
34
34
  border-color: var(--sys-color-error-border);
35
35
  background: var(--sys-color-error-bg);
36
36
  color: var(--sys-color-error-fg);
37
37
  }
38
- ._link_1v5fo_38 {
38
+ ._tile_gqsrq_3:any-link {
39
39
  display: block;
40
40
  color: var(--attachment-tile-fg, var(--sys-color-text-muted));
41
41
  text-decoration: none;
42
42
  cursor: pointer;
43
43
  }
44
- ._link_1v5fo_38:hover {
44
+ ._tile_gqsrq_3:any-link:hover {
45
45
  border-color: var(--attachment-tile-hover-border, var(--sys-color-primary));
46
46
  color: var(--attachment-tile-fg, var(--sys-color-text-muted));
47
47
  }
48
- ._preview_1v5fo_48 {
48
+ ._preview_gqsrq_48 {
49
49
  display: flex;
50
50
  flex-direction: column;
51
51
  align-items: center;
@@ -56,23 +56,32 @@
56
56
  overflow: hidden;
57
57
  border-radius: var(--_tile-inner-radius);
58
58
  }
59
- ._image_1v5fo_59 {
59
+ ._image_gqsrq_59 {
60
60
  inline-size: 100%;
61
61
  block-size: 100%;
62
62
  object-fit: cover;
63
63
  }
64
- ._imageSkeleton_1v5fo_64 {
64
+ ._imageSkeleton_gqsrq_64 {
65
65
  --skeleton-bg: var(--sys-color-outline);
66
66
  position: absolute;
67
67
  inset: 0;
68
68
  border-radius: var(--_tile-inner-radius);
69
69
  block-size: auto;
70
70
  }
71
- ._extension_1v5fo_71 {
71
+ ._icon_gqsrq_71 {
72
+ display: inline-flex;
73
+ font-size: var(--attachment-tile-icon-size, 1.5em);
74
+ }
75
+ ._icon_gqsrq_71 > svg {
76
+ inline-size: 1em;
77
+ block-size: 1em;
78
+ fill: currentcolor;
79
+ }
80
+ ._extension_gqsrq_80 {
72
81
  font: var(--sys-font-label-small);
73
82
  text-transform: uppercase;
74
83
  }
75
- ._name_1v5fo_75 {
84
+ ._name_gqsrq_84 {
76
85
  position: absolute;
77
86
  overflow: hidden;
78
87
  clip-path: inset(50%);
@@ -80,7 +89,7 @@
80
89
  block-size: 1px;
81
90
  white-space: nowrap;
82
91
  }
83
- ._remove_1v5fo_83 {
92
+ ._remove_gqsrq_92 {
84
93
  display: grid;
85
94
  place-items: center;
86
95
  position: absolute;
@@ -1,30 +1,74 @@
1
- import { type ReactNode } from "react";
1
+ import { useRender } from "@base-ui/react/use-render";
2
+ import { type ReactElement, type ReactNode } from "react";
3
+ import { AttachmentPreview } from "./attachment-preview.tsx";
4
+ export type AttachmentTileRootProps = useRender.ComponentProps<"span"> & Readonly<{
5
+ /** Renders with an error treatment, such as for an oversized file. */
6
+ invalid?: boolean;
7
+ }>;
8
+ /**
9
+ * The square frame of a tile. Render it as react-aria's `Tag` inside a
10
+ * `TagList` for a staged file, or as an `<a>` for a download.
11
+ */
12
+ declare const Root: ({ invalid, className, render, ref, ...props }: AttachmentTileRootProps) => ReactElement;
13
+ export type AttachmentTileRemoveProps = Readonly<{
14
+ /** The button's accessible name and tooltip, such as "Remove". */
15
+ label: string;
16
+ /** The remove glyph. */
17
+ children: ReactNode;
18
+ className?: string;
19
+ }>;
20
+ /**
21
+ * The pointer-only remove button in a staged tile's corner, its children the
22
+ * glyph. The surrounding `TagGroup` owns the removal, and the keyboard removes
23
+ * with Delete.
24
+ */
25
+ declare const Remove: ({ label, children, className, }: AttachmentTileRemoveProps) => ReactNode;
2
26
  export type AttachmentTileProps = Readonly<{
3
27
  id: string;
4
28
  file: File;
5
29
  /** Tooltip text for the tile, e.g. "nota.pdf (12 kB)". */
6
30
  hint: string;
7
- /** Accessible name for the remove button; without one the tile is fixed. */
8
- removeLabel?: string;
9
31
  /** Renders with an error treatment (e.g. an oversized file). */
10
32
  invalid: boolean;
11
33
  disabled: boolean;
34
+ /** A file-type glyph, shown above the extension where the file is not an image. */
35
+ icon?: ReactNode;
36
+ className?: string;
37
+ }> & (Readonly<{
38
+ /** Accessible name for the remove button; without one the tile is fixed. */
39
+ removeLabel: string;
40
+ /** The remove button's glyph. */
41
+ removeIcon: ReactNode;
42
+ }> | Readonly<{
43
+ removeLabel?: undefined;
44
+ removeIcon?: undefined;
45
+ }>);
46
+ declare const Prefab: ({ id, file, hint, removeLabel, removeIcon, invalid, disabled, icon, className, }: AttachmentTileProps) => ReactNode;
47
+ /** The parts of an attachment tile, hanging off its prefab. */
48
+ export type AttachmentTileParts = typeof Prefab & Readonly<{
49
+ Root: typeof Root;
50
+ Preview: typeof AttachmentPreview;
51
+ Remove: typeof Remove;
12
52
  }>;
13
53
  /**
14
54
  * A single staged attachment as a square thumbnail inside a `TagList`: an image
15
55
  * preview where the file is one, its extension otherwise, and a pointer-only
16
56
  * remove button in the corner. Removal is owned by the surrounding `TagGroup`.
57
+ * The parts hanging off it compose a tile by hand.
17
58
  *
18
59
  * @example
19
- * <AttachmentTile id={id} file={file} hint={hint} removeLabel={label} invalid={false} disabled={false} />
60
+ * <AttachmentTile id={id} file={file} hint={hint} removeLabel="Remove" removeIcon={<CloseIcon />} invalid={false} disabled={false} />
20
61
  */
21
- export declare const AttachmentTile: ({ id, file, hint, removeLabel, invalid, disabled, }: AttachmentTileProps) => ReactNode;
62
+ export declare const AttachmentTile: AttachmentTileParts;
22
63
  export type SentAttachmentTileProps = Readonly<{
23
64
  name: string;
24
65
  /** Tooltip text for the tile. */
25
66
  hint: string;
67
+ /** A file-type glyph, shown above the extension where there is no image. */
68
+ icon?: ReactNode;
69
+ className?: string;
26
70
  }> & (Readonly<{
27
- /** Image source; without one the tile shows a glyph and the extension. */
71
+ /** Image source; without one the tile shows its icon and the extension. */
28
72
  src: string;
29
73
  pending?: false;
30
74
  }> | Readonly<{
@@ -49,3 +93,4 @@ export type SentAttachmentTileProps = Readonly<{
49
93
  * <SentAttachmentTile name="nota.pdf" hint="nota.pdf (12 kB)" src={url} href={url} label="Download nota.pdf" />
50
94
  */
51
95
  export declare const SentAttachmentTile: (props: SentAttachmentTileProps) => ReactNode;
96
+ export {};