@vev/silke 1.2.0 → 1.2.2

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 (231) hide show
  1. package/.turbo/turbo-build.log +87 -87
  2. package/CHANGELOG.md +18 -0
  3. package/dist/index.js +42 -45
  4. package/dist/index.js.LEGAL.txt +2 -1
  5. package/dist/index.js.map +4 -4
  6. package/dist/styles.css +145 -119
  7. package/dist/types/components/silke-action-box/silke-action-box.d.ts +1 -1
  8. package/dist/types/components/silke-alert-banner/silke-alert-banner.d.ts +1 -1
  9. package/dist/types/components/silke-autocomplete-field/autocomplete-item.d.ts +1 -1
  10. package/dist/types/components/silke-autocomplete-field/autocomplete-tags.d.ts +2 -1
  11. package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field-native.d.ts +1 -1
  12. package/dist/types/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +1 -1
  13. package/dist/types/components/silke-autocomplete-field/silke-autocomplete-popup-native.d.ts +2 -2
  14. package/dist/types/components/silke-autocomplete-field/silke-autocomplete-popup.d.ts +2 -2
  15. package/dist/types/components/silke-box/silke-box.d.ts +1 -1
  16. package/dist/types/components/silke-breadcrumbs/silke-breadcrumb.d.ts +1 -1
  17. package/dist/types/components/silke-breadcrumbs/silke-breadcrumbs.d.ts +2 -1
  18. package/dist/types/components/silke-button/context.d.ts +1 -1
  19. package/dist/types/components/silke-button/silke-big-button.d.ts +1 -1
  20. package/dist/types/components/silke-button/silke-button-set.d.ts +1 -1
  21. package/dist/types/components/silke-button/silke-confirmation-button.d.ts +1 -1
  22. package/dist/types/components/silke-button/silke-dropdown-button.d.ts +2 -1
  23. package/dist/types/components/silke-button/silke-file-select-button.d.ts +2 -1
  24. package/dist/types/components/silke-card/silke-card-grid.d.ts +1 -1
  25. package/dist/types/components/silke-card/silke-card.spec.d.ts +1 -0
  26. package/dist/types/components/silke-checkbox/silke-checkbox.d.ts +1 -1
  27. package/dist/types/components/silke-code-editor/index.d.ts +2 -1
  28. package/dist/types/components/silke-code-editor/silke-code-editor.d.ts +2 -1
  29. package/dist/types/components/silke-code-snippet/silke-code-snippet.d.ts +1 -1
  30. package/dist/types/components/silke-color-palettes/silke-color-palette.d.ts +2 -1
  31. package/dist/types/components/silke-color-palettes/silke-color-palettes.d.ts +2 -1
  32. package/dist/types/components/silke-color-picker/silke-color-info.d.ts +2 -1
  33. package/dist/types/components/silke-color-picker/silke-color-picker-button.d.ts +1 -1
  34. package/dist/types/components/silke-color-picker/silke-color-picker.d.ts +2 -1
  35. package/dist/types/components/silke-color-picker/silke-color-space.d.ts +2 -1
  36. package/dist/types/components/silke-color-picker/silke-hue-slider.d.ts +2 -1
  37. package/dist/types/components/silke-color-picker/silke-opacity-slider.d.ts +2 -1
  38. package/dist/types/components/silke-color-swatches/silke-swatches.d.ts +2 -1
  39. package/dist/types/components/silke-command-text-field/attachment-chip.d.ts +2 -1
  40. package/dist/types/components/silke-command-text-field/attachment-list.d.ts +2 -0
  41. package/dist/types/components/silke-command-text-field/file-utils.d.ts +21 -1
  42. package/dist/types/components/silke-command-text-field/index.d.ts +1 -1
  43. package/dist/types/components/silke-command-text-field/silke-command-text-field.d.ts +2 -0
  44. package/dist/types/components/silke-conditions-input/silke-conditions-input-options.d.ts +2 -1
  45. package/dist/types/components/silke-conditions-input/silke-conditions-input.d.ts +2 -1
  46. package/dist/types/components/silke-conditions-input/silke-conditions-tag.d.ts +2 -1
  47. package/dist/types/components/silke-content-column/silke-content-column.d.ts +2 -1
  48. package/dist/types/components/silke-context-menu/silke-context-menu-item.d.ts +1 -1
  49. package/dist/types/components/silke-context-menu/silke-context-menu.d.ts +1 -1
  50. package/dist/types/components/silke-css-number-field/silke-css-context.d.ts +1 -1
  51. package/dist/types/components/silke-css-number-field/silke-css-number-field.d.ts +1 -1
  52. package/dist/types/components/silke-divider/silke-divider.d.ts +2 -1
  53. package/dist/types/components/silke-drawer/silke-drawer.d.ts +1 -1
  54. package/dist/types/components/silke-expression-input/silke-expression-input-tag.d.ts +2 -1
  55. package/dist/types/components/silke-form/form-context.d.ts +1 -1
  56. package/dist/types/components/silke-form/silke-form.d.ts +2 -2
  57. package/dist/types/components/silke-form-schema/fields/array-field-inline.d.ts +2 -1
  58. package/dist/types/components/silke-form-schema/fields/array-field-modal.d.ts +2 -2
  59. package/dist/types/components/silke-form-schema/fields/array-field.d.ts +2 -1
  60. package/dist/types/components/silke-form-schema/fields/audio-field.d.ts +2 -1
  61. package/dist/types/components/silke-form-schema/fields/color-field.d.ts +2 -1
  62. package/dist/types/components/silke-form-schema/fields/event-field.d.ts +2 -1
  63. package/dist/types/components/silke-form-schema/fields/group-field.d.ts +2 -1
  64. package/dist/types/components/silke-form-schema/fields/icon-field.d.ts +2 -1
  65. package/dist/types/components/silke-form-schema/fields/image-field.d.ts +2 -1
  66. package/dist/types/components/silke-form-schema/fields/layout-field.d.ts +2 -1
  67. package/dist/types/components/silke-form-schema/fields/link-field.d.ts +2 -1
  68. package/dist/types/components/silke-form-schema/fields/number-field.d.ts +2 -1
  69. package/dist/types/components/silke-form-schema/fields/object-field.d.ts +2 -1
  70. package/dist/types/components/silke-form-schema/fields/popover-field.d.ts +2 -1
  71. package/dist/types/components/silke-form-schema/fields/select-field.d.ts +2 -1
  72. package/dist/types/components/silke-form-schema/fields/string-field.d.ts +2 -1
  73. package/dist/types/components/silke-form-schema/fields/toggle-field.d.ts +2 -1
  74. package/dist/types/components/silke-form-schema/fields/upload-field.d.ts +2 -1
  75. package/dist/types/components/silke-form-schema/fields/utils/generate-preview.spec.d.ts +1 -0
  76. package/dist/types/components/silke-form-schema/fields/utils/generate-title.d.ts +10 -0
  77. package/dist/types/components/silke-form-schema/fields/video-field.d.ts +2 -1
  78. package/dist/types/components/silke-form-schema/silke-extended-fields-context.d.ts +3 -3
  79. package/dist/types/components/silke-form-schema/silke-form-schema.d.ts +5 -2
  80. package/dist/types/components/silke-form-schema/silke-schema-context.d.ts +2 -2
  81. package/dist/types/components/silke-form-schema/silke-schema-decorator.d.ts +14 -3
  82. package/dist/types/components/silke-form-schema/silke-schema-field.d.ts +2 -1
  83. package/dist/types/components/silke-form-schema/silke-schema-fields.d.ts +2 -1
  84. package/dist/types/components/silke-gradient-picker/silke-gradient-picker.d.ts +2 -1
  85. package/dist/types/components/silke-gradient-picker/silke-gradient-position.d.ts +2 -1
  86. package/dist/types/components/silke-gradient-picker/silke-gradient-slider.d.ts +2 -1
  87. package/dist/types/components/silke-icon/silke-icon.d.ts +1 -1
  88. package/dist/types/components/silke-icon/silke-shape.d.ts +2 -1
  89. package/dist/types/components/silke-icon/silke-stacked-icon.d.ts +2 -1
  90. package/dist/types/components/silke-icon-picker/color-swatch-section.d.ts +2 -1
  91. package/dist/types/components/silke-icon-picker/emoji-tab.d.ts +2 -1
  92. package/dist/types/components/silke-icon-picker/icons-tab.d.ts +2 -1
  93. package/dist/types/components/silke-icon-picker/silke-icon-picker.d.ts +2 -1
  94. package/dist/types/components/silke-icon-picker/upload-tab.d.ts +2 -1
  95. package/dist/types/components/silke-iframe-portal/silke-iframe-portal.d.ts +1 -1
  96. package/dist/types/components/silke-image/silke-image-color-backdrop.d.ts +2 -1
  97. package/dist/types/components/silke-image/silke-image.d.ts +2 -1
  98. package/dist/types/components/silke-link/silke-link.d.ts +1 -1
  99. package/dist/types/components/silke-list/silke-list-item.d.ts +1 -1
  100. package/dist/types/components/silke-list/silke-list.d.ts +2 -1
  101. package/dist/types/components/silke-loader/silke-loader-overlay.d.ts +1 -1
  102. package/dist/types/components/silke-loader/silke-loader.d.ts +2 -2
  103. package/dist/types/components/silke-modal/silke-confirmation-modal.d.ts +2 -1
  104. package/dist/types/components/silke-modal/silke-modal.d.ts +3 -3
  105. package/dist/types/components/silke-object-field/silke-object-field.d.ts +1 -1
  106. package/dist/types/components/silke-overflow-menu/silke-overflow-menu.d.ts +1 -1
  107. package/dist/types/components/silke-popover/popover-context.d.ts +1 -1
  108. package/dist/types/components/silke-popover/silke-popover.d.ts +2 -2
  109. package/dist/types/components/silke-popover-native/silke-popover-native.d.ts +1 -1
  110. package/dist/types/components/silke-popover-native/types.d.ts +1 -1
  111. package/dist/types/components/silke-popover-native/use-popover-positioning.d.ts +1 -1
  112. package/dist/types/components/silke-progress-indicator/silke-progress-indicator.d.ts +1 -1
  113. package/dist/types/components/silke-progress-indicator/silke-progress-step.d.ts +2 -1
  114. package/dist/types/components/silke-radio-button/silke-radio-button-group.d.ts +1 -1
  115. package/dist/types/components/silke-radio-button/silke-radio-button.d.ts +1 -1
  116. package/dist/types/components/silke-rich-text-field/blockquote.d.ts +3 -18
  117. package/dist/types/components/silke-rich-text-field/floating-layer.d.ts +5 -1
  118. package/dist/types/components/silke-rich-text-field/floating-layer.spec.d.ts +1 -0
  119. package/dist/types/components/silke-rich-text-field/formatting-toolbar.d.ts +2 -1
  120. package/dist/types/components/silke-rich-text-field/link-menu.d.ts +1 -1
  121. package/dist/types/components/silke-rich-text-field/link-tooltip.d.ts +2 -1
  122. package/dist/types/components/silke-rich-text-field/silke-rich-text-field.d.ts +1 -1
  123. package/dist/types/components/silke-rich-text-field/slash-menu.d.ts +5 -4
  124. package/dist/types/components/silke-rich-text-field/slash-menu.spec.d.ts +1 -0
  125. package/dist/types/components/silke-rich-text-field/table-toolbar.d.ts +2 -1
  126. package/dist/types/components/silke-rich-text-field/use-link-hover.d.ts +1 -1
  127. package/dist/types/components/silke-rich-text-field/utils.d.ts +29 -1
  128. package/dist/types/components/silke-rich-text-field/utils.spec.d.ts +1 -0
  129. package/dist/types/components/silke-search-field/silke-search-field.d.ts +2 -1
  130. package/dist/types/components/silke-select-field/silke-select-field-native.d.ts +2 -1
  131. package/dist/types/components/silke-select-field/silke-select-field.d.ts +2 -1
  132. package/dist/types/components/silke-shortcut-button/silke-shortcut-button.d.ts +1 -1
  133. package/dist/types/components/silke-skeleton/silke-skeleton.d.ts +1 -1
  134. package/dist/types/components/silke-slider/silke-slider-point.d.ts +1 -1
  135. package/dist/types/components/silke-slider/silke-slider.d.ts +1 -1
  136. package/dist/types/components/silke-slider/slider-track.d.ts +1 -1
  137. package/dist/types/components/silke-sortable-list/silke-nested-sortable-item.d.ts +1 -1
  138. package/dist/types/components/silke-sortable-list/silke-nested-sortable-list.d.ts +1 -1
  139. package/dist/types/components/silke-sortable-list/silke-sortable-item-wrapper.d.ts +1 -1
  140. package/dist/types/components/silke-sortable-list/silke-sortable-list.d.ts +1 -1
  141. package/dist/types/components/silke-table/silke-table.d.ts +1 -1
  142. package/dist/types/components/silke-table/table-row.d.ts +2 -1
  143. package/dist/types/components/silke-tabs/silke-tab.d.ts +1 -1
  144. package/dist/types/components/silke-tabs/silke-tabs.d.ts +1 -1
  145. package/dist/types/components/silke-tag/silke-tag.d.ts +6 -6
  146. package/dist/types/components/silke-text/silke-text.d.ts +27 -13
  147. package/dist/types/components/silke-text/silke-title.d.ts +2 -1
  148. package/dist/types/components/silke-text-field/text-field-context.d.ts +1 -1
  149. package/dist/types/components/silke-theme-card/silke-theme-card.d.ts +2 -1
  150. package/dist/types/components/silke-theme-editor/silke-theme-editor.d.ts +2 -1
  151. package/dist/types/components/silke-theme-swatch/silke-theme-swatch.d.ts +2 -1
  152. package/dist/types/components/silke-tile/silke-tile.d.ts +2 -2
  153. package/dist/types/components/silke-toast-notification/silke-toast-notification.d.ts +1 -1
  154. package/dist/types/components/silke-toggle/silke-toggle.d.ts +1 -1
  155. package/dist/types/components/silke-toolbar/silke-toolbar.d.ts +2 -1
  156. package/dist/types/components/silke-tooltip/silke-definition-tooltip.d.ts +1 -1
  157. package/dist/types/components/silke-tooltip/silke-icon-tooltip.d.ts +1 -1
  158. package/dist/types/components/silke-tooltip/silke-interactive-tooltip.d.ts +1 -1
  159. package/dist/types/components/silke-tooltip/silke-shortcuts.d.ts +2 -1
  160. package/dist/types/components/silke-tooltip/silke-tooltip.d.ts +1 -1
  161. package/dist/types/components/silke-upload-field/silke-upload-field.d.ts +1 -1
  162. package/dist/types/components/silke-variables-wrapper/silke-variables-wrapper-form.d.ts +2 -2
  163. package/dist/types/components/silke-variables-wrapper/silke-variables-wrapper.d.ts +1 -1
  164. package/dist/types/components/silke-virtual/silke-virtual-grid.d.ts +1 -1
  165. package/dist/types/components/silke-virtual/silke-virtual-row.d.ts +1 -1
  166. package/dist/types/hooks/use-drop-zone.d.ts +1 -1
  167. package/dist/types/hooks/use-mouse.d.ts +1 -1
  168. package/dist/types/hooks/use-parent-scroll.d.ts +1 -1
  169. package/dist/types/hooks/use-size.d.ts +1 -1
  170. package/dist/types/icons.d.ts +33 -32
  171. package/dist/types/silke-theme-provider.d.ts +1 -1
  172. package/package.json +18 -16
  173. package/src/@types/declarations.d.ts +1 -1
  174. package/src/components/silke-alert-banner/silke-alert-banner.tsx +1 -1
  175. package/src/components/silke-autocomplete-field/silke-autocomplete-field-native.tsx +3 -3
  176. package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +4 -4
  177. package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +6 -6
  178. package/src/components/silke-autocomplete-field/silke-autocomplete-popup.tsx +6 -6
  179. package/src/components/silke-card/silke-card.scss +30 -3
  180. package/src/components/silke-card/silke-card.spec.tsx +32 -0
  181. package/src/components/silke-card/silke-card.tsx +62 -34
  182. package/src/components/silke-command-text-field/attachment-list.tsx +6 -7
  183. package/src/components/silke-command-text-field/file-utils.ts +103 -23
  184. package/src/components/silke-command-text-field/index.ts +3 -0
  185. package/src/components/silke-command-text-field/silke-command-text-field.mdx +5 -1
  186. package/src/components/silke-command-text-field/silke-command-text-field.tsx +26 -29
  187. package/src/components/silke-conditions-input/silke-conditions-input-options.tsx +1 -1
  188. package/src/components/silke-css-number-field/silke-css-number-field.tsx +4 -4
  189. package/src/components/silke-drawer/silke-drawer.tsx +1 -1
  190. package/src/components/silke-form-schema/fields/string-field.tsx +8 -6
  191. package/src/components/silke-form-schema/fields/utils/generate-image.ts +5 -14
  192. package/src/components/silke-form-schema/fields/utils/generate-preview.spec.ts +49 -0
  193. package/src/components/silke-form-schema/fields/utils/generate-title.ts +23 -10
  194. package/src/components/silke-form-schema/safe-eval/iframe-script.raw.js +1 -0
  195. package/src/components/silke-form-schema/schema-utils.ts +29 -2
  196. package/src/components/silke-form-schema/silke-extended-fields-context.tsx +1 -1
  197. package/src/components/silke-form-schema/silke-form-schema.tsx +9 -2
  198. package/src/components/silke-form-schema/silke-schema-decorator.tsx +22 -1
  199. package/src/components/silke-form-schema/silke-schema-field.tsx +13 -2
  200. package/src/components/silke-icon/silke-icon.tsx +1 -1
  201. package/src/components/silke-list/silke-list.tsx +15 -8
  202. package/src/components/silke-object-field/silke-object-field.tsx +1 -1
  203. package/src/components/silke-popover/silke-popover.tsx +14 -10
  204. package/src/components/silke-popover-native/types.ts +1 -1
  205. package/src/components/silke-popover-native/use-popover-positioning.ts +1 -1
  206. package/src/components/silke-rich-text-field/blockquote.spec.ts +118 -25
  207. package/src/components/silke-rich-text-field/blockquote.ts +46 -53
  208. package/src/components/silke-rich-text-field/floating-layer.spec.tsx +20 -0
  209. package/src/components/silke-rich-text-field/floating-layer.tsx +16 -1
  210. package/src/components/silke-rich-text-field/plugins.ts +1 -2
  211. package/src/components/silke-rich-text-field/silke-rich-text-field.scss +10 -0
  212. package/src/components/silke-rich-text-field/silke-rich-text-field.tsx +9 -4
  213. package/src/components/silke-rich-text-field/slash-menu-items.ts +1 -4
  214. package/src/components/silke-rich-text-field/slash-menu.spec.tsx +52 -0
  215. package/src/components/silke-rich-text-field/slash-menu.tsx +28 -14
  216. package/src/components/silke-rich-text-field/utils.spec.ts +115 -0
  217. package/src/components/silke-rich-text-field/utils.ts +76 -2
  218. package/src/components/silke-tag/silke-tag.tsx +1 -1
  219. package/src/components/silke-text-field/silke-text-field.tsx +2 -2
  220. package/src/components/silke-theme-swatch/silke-theme-swatch.tsx +11 -6
  221. package/src/components/silke-toast-notification/confetti.tsx +1 -1
  222. package/src/components/silke-toast-notification/silke-toast-notification.tsx +1 -1
  223. package/src/components/silke-upload-field/silke-upload-field.tsx +2 -2
  224. package/src/components/silke-variables-wrapper/silke-variables-wrapper-form.tsx +1 -1
  225. package/src/components/silke-variables-wrapper/silke-variables-wrapper.tsx +9 -3
  226. package/src/hooks/form/use-form-field.ts +2 -2
  227. package/src/hooks/use-drop-zone.ts +1 -1
  228. package/src/hooks/use-html-element.ts +1 -1
  229. package/src/hooks/use-mouse.ts +1 -1
  230. package/src/hooks/use-parent-scroll.ts +1 -1
  231. package/src/hooks/use-size.ts +1 -1
@@ -33,7 +33,7 @@ body {
33
33
  }
34
34
 
35
35
  &:hover,
36
- &:focus-visible {
36
+ &:focus-within {
37
37
  &.hasTags {
38
38
  .img {
39
39
  scale: 0.97;
@@ -50,7 +50,7 @@ body {
50
50
  }
51
51
 
52
52
  &:hover,
53
- &:focus-visible {
53
+ &:focus-within {
54
54
  .tags,
55
55
  .checkbox,
56
56
  .overflowMenu {
@@ -72,7 +72,10 @@ body {
72
72
  }
73
73
  }
74
74
 
75
- &:focus-visible {
75
+ // The focus ring is drawn on the image for the card and for the title link
76
+ // inside it, which is what the keyboard lands on when the card is linked.
77
+ &:focus-visible,
78
+ &:has(:focus-visible) {
76
79
  outline: none;
77
80
  border: none;
78
81
  .imageWrapper {
@@ -80,6 +83,28 @@ body {
80
83
  }
81
84
  }
82
85
 
86
+ .cardText {
87
+ color: inherit;
88
+ text-decoration: none;
89
+ &:focus-visible {
90
+ outline: none;
91
+ }
92
+ }
93
+
94
+ // Covers the image so it opens the link, while the tags and checkbox stay
95
+ // separate controls above it.
96
+ .imageLink {
97
+ position: absolute;
98
+ inset: 0;
99
+ z-index: 1;
100
+ }
101
+
102
+ .checkbox,
103
+ .tags,
104
+ .tagsTop {
105
+ z-index: 2;
106
+ }
107
+
83
108
  .ribbon {
84
109
  position: absolute;
85
110
  top: 8px;
@@ -176,6 +201,8 @@ body {
176
201
  gap: 4px;
177
202
  }
178
203
  .cardText {
204
+ color: inherit;
205
+ text-decoration: none;
179
206
  gap: 2px;
180
207
  }
181
208
 
@@ -0,0 +1,32 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import React from 'react';
3
+ import { MemoryRouter } from 'react-router-dom';
4
+ import { SilkeCard } from './silke-card';
5
+
6
+ it('renders a plain card without a router', () => {
7
+ render(<SilkeCard title="Plain" onClick={() => {}} />);
8
+ expect(screen.getByText('Plain')).toBeTruthy();
9
+ expect(screen.queryByRole('link')).toBeNull();
10
+ });
11
+
12
+ it('keeps a linked tag a real anchor beside the card link, never inside it', () => {
13
+ const { container } = render(
14
+ <MemoryRouter>
15
+ <SilkeCard
16
+ title="Project"
17
+ link="/edit/project"
18
+ tags={[{ label: 'Workspace', link: '/folder/workspace' }]}
19
+ />
20
+ </MemoryRouter>,
21
+ );
22
+ const title = screen.getByRole('link', { name: 'Project' });
23
+ expect(title.getAttribute('href')).toBe('/edit/project');
24
+ expect(title.textContent).toBe('Project');
25
+ const tag = screen.getByRole('link', { name: 'Workspace' });
26
+ expect(tag.getAttribute('href')).toBe('/folder/workspace');
27
+ expect(container.querySelector('a a')).toBeNull();
28
+ // The image overlay opens the link too but stays out of the tab order.
29
+ const links = container.querySelectorAll('a[href="/edit/project"]');
30
+ expect(links).toHaveLength(2);
31
+ expect([...links].filter((a) => a.getAttribute('tabindex') === '-1')).toHaveLength(1);
32
+ });
@@ -1,5 +1,6 @@
1
1
  import { isArray, isString } from 'lodash';
2
2
  import React, { useState } from 'react';
3
+ import { useUniqId } from '../../hooks/use-uniq-id';
3
4
  import { SilkeColor } from '../../silke-theme-provider';
4
5
  import { SilkeBox } from '../silke-box';
5
6
  import { SilkeCheckbox } from '../silke-checkbox';
@@ -43,6 +44,14 @@ const stopPropagation = (e: React.MouseEvent) => {
43
44
  e.stopPropagation();
44
45
  };
45
46
 
47
+ /** A linked tag is its own anchor; its clicks and context menu must not reach the card's. */
48
+ function CardTag({ tag }: { tag: SilkeTagProps }) {
49
+ if (!tag.link) return <SilkeTag kind="secondary" {...tag} />;
50
+ return (
51
+ <SilkeTag kind="secondary" {...tag} onClick={stopPropagation} onContextMenu={stopPropagation} />
52
+ );
53
+ }
54
+
46
55
  export const SilkeCard = React.forwardRef(
47
56
  (
48
57
  {
@@ -68,7 +77,7 @@ export const SilkeCard = React.forwardRef(
68
77
  cardRef,
69
78
  ) => {
70
79
  const [showContextMenu, setShowContextMenu] = useState(false);
71
-
80
+ const titleId = useUniqId('silke-card-title');
72
81
  let cl = styles.card;
73
82
  if (className) cl += ' ' + className;
74
83
  if (colorBackdrop) cl += ' ' + styles.colorBackdrop;
@@ -77,15 +86,38 @@ export const SilkeCard = React.forwardRef(
77
86
  if (selected) cl += ' ' + styles.selected;
78
87
  if (imageFit === 'contain') cl += ' ' + styles.imgContain;
79
88
 
89
+ const textProps = {
90
+ flex: true,
91
+ column: true,
92
+ gap: 'xs',
93
+ className: `${styles.cardText} ${styles.overflowHidden}`,
94
+ } as const;
95
+ const titleBlock = (
96
+ <>
97
+ <SilkeText
98
+ id={titleId}
99
+ size="base"
100
+ flex
101
+ overflow
102
+ className={styles.title}
103
+ title={typeof title === 'string' ? title : undefined}
104
+ >
105
+ {title}
106
+ </SilkeText>
107
+ {subTitle && (
108
+ <SilkeText size="small" tag="small" color="neutral-70" className={styles.subTitle}>
109
+ {subTitle}
110
+ </SilkeText>
111
+ )}
112
+ </>
113
+ );
114
+
80
115
  return (
81
116
  <SilkeBox
82
- tag={link ? 'link' : 'div'}
83
- to={link}
84
117
  ref={cardRef}
85
118
  column
86
- role={link ? 'link' : undefined}
87
- tabIndex={rest.onClick ? 1 : undefined}
88
- aria-label={rest.onClick && isString(title) ? title : undefined}
119
+ tabIndex={rest.onClick && !link ? 1 : undefined}
120
+ aria-label={rest.onClick && !link && isString(title) ? title : undefined}
89
121
  className={cl}
90
122
  onContextMenu={(e: MouseEvent) => {
91
123
  e.preventDefault();
@@ -126,6 +158,21 @@ export const SilkeCard = React.forwardRef(
126
158
  ) : (
127
159
  image
128
160
  ))}
161
+ {link && (
162
+ // The card is not one <a> around everything: that cannot hold the
163
+ // tags' anchors (nested anchors are invalid HTML), and a tag that is
164
+ // not a real anchor loses middle-click, "Copy link" and the other
165
+ // native link gestures. Instead the image gets this overlay and the
166
+ // title block below is a second link; the tags, checkbox and menus
167
+ // are siblings of both. Only the title link is in the tab order.
168
+ <SilkeBox
169
+ tag="link"
170
+ to={link}
171
+ className={styles.imageLink}
172
+ tabIndex={-1}
173
+ aria-hidden="true"
174
+ />
175
+ )}
129
176
 
130
177
  {onCheck && (
131
178
  <SilkeBox
@@ -140,7 +187,7 @@ export const SilkeCard = React.forwardRef(
140
187
  {tagsTop && (
141
188
  <SilkeBox gap="xxs" className={styles.tagsTop}>
142
189
  {tagsTop?.map((tagContent, i) => (
143
- <SilkeTag key={i} kind="secondary" {...tagContent} />
190
+ <CardTag key={i} tag={tagContent} />
144
191
  ))}
145
192
  </SilkeBox>
146
193
  )}
@@ -148,39 +195,20 @@ export const SilkeCard = React.forwardRef(
148
195
  <SilkeBox gap="xxs" className={styles.tags}>
149
196
  {customTags}
150
197
  {tags?.map((tagContent, i) => (
151
- <SilkeTag
152
- key={i}
153
- kind="secondary"
154
- {...tagContent}
155
- onClick={tagContent.link ? stopPropagation : tagContent.onClick}
156
- />
198
+ <CardTag key={i} tag={tagContent} />
157
199
  ))}
158
200
  </SilkeBox>
159
201
  )}
160
202
  </SilkeBox>
161
203
  <SilkeBox gap="m" column flex>
162
204
  <SilkeBox vAlign="center">
163
- <SilkeBox
164
- flex
165
- column
166
- gap="xs"
167
- className={`${styles.cardText} ${styles.overflowHidden}`}
168
- >
169
- <SilkeText
170
- size="base"
171
- flex
172
- overflow
173
- className={styles.title}
174
- title={typeof title === 'string' ? title : undefined}
175
- >
176
- {title}
177
- </SilkeText>
178
- {subTitle && (
179
- <SilkeText size="small" tag="small" color="neutral-70" className={styles.subTitle}>
180
- {subTitle}
181
- </SilkeText>
182
- )}
183
- </SilkeBox>
205
+ {link ? (
206
+ <SilkeBox tag="link" to={link} aria-labelledby={titleId} {...textProps}>
207
+ {titleBlock}
208
+ </SilkeBox>
209
+ ) : (
210
+ <SilkeBox {...textProps}>{titleBlock}</SilkeBox>
211
+ )}
184
212
  {onMore && (
185
213
  <SilkeButton
186
214
  size="s"
@@ -1,10 +1,12 @@
1
1
  import React, { useCallback, useImperativeHandle, useRef } from 'react';
2
2
  import { AttachmentChip } from './attachment-chip';
3
- import { fileToAttachmentValue } from './file-utils';
3
+ import { filesToAttachmentValues } from './file-utils';
4
4
  import styles from './silke-command-text-field.module.scss';
5
5
  import { SilkeFileValue, SilkeImageValue } from './utils';
6
6
 
7
7
  interface AttachmentListProps {
8
+ /** `accept` attribute of the file picker, defaults to the accepted MIME patterns */
9
+ accept?: string;
8
10
  acceptedTypes: string[];
9
11
  attachments: (SilkeImageValue | SilkeFileValue)[];
10
12
  disabled?: boolean;
@@ -18,7 +20,7 @@ export interface AttachmentListHandle {
18
20
  }
19
21
 
20
22
  export const AttachmentList = React.forwardRef<AttachmentListHandle, AttachmentListProps>(
21
- ({ acceptedTypes, attachments, disabled, onAdd, onRemove }, ref) => {
23
+ ({ accept, acceptedTypes, attachments, disabled, onAdd, onRemove }, ref) => {
22
24
  const fileInputRef = useRef<HTMLInputElement>(null);
23
25
 
24
26
  const handleFileSelect = useCallback(
@@ -26,10 +28,7 @@ export const AttachmentList = React.forwardRef<AttachmentListHandle, AttachmentL
26
28
  const { files } = e.target;
27
29
  if (!files || files.length === 0) return;
28
30
 
29
- Promise.all(
30
- Array.from(files).map((file) => fileToAttachmentValue(file, acceptedTypes)),
31
- ).then((results) => {
32
- const valid = results.filter((v): v is SilkeImageValue | SilkeFileValue => v !== null);
31
+ filesToAttachmentValues(Array.from(files), acceptedTypes).then((valid) => {
33
32
  if (valid.length > 0) onAdd(valid);
34
33
  });
35
34
  // Reset so the same file can be selected again
@@ -60,7 +59,7 @@ export const AttachmentList = React.forwardRef<AttachmentListHandle, AttachmentL
60
59
  ref={fileInputRef}
61
60
  type="file"
62
61
  className={styles.fileInput}
63
- accept={acceptedTypes.join(',')}
62
+ accept={accept ?? acceptedTypes.join(',')}
64
63
  multiple
65
64
  onChange={handleFileSelect}
66
65
  />
@@ -2,7 +2,7 @@ import type { SilkeIcons } from '../silke-icon/silke-icon';
2
2
  import { SilkeFileValue, SilkeImageValue } from './utils';
3
3
 
4
4
  /** File type category for the acceptedFileTypes prop */
5
- export type SilkeFileCategory = 'image' | 'text';
5
+ export type SilkeFileCategory = 'image' | 'text' | 'document' | '3d';
6
6
 
7
7
  /** MIME patterns for each file category */
8
8
  const FILE_CATEGORY_PATTERNS: Record<SilkeFileCategory, string[]> = {
@@ -21,6 +21,44 @@ const FILE_CATEGORY_PATTERNS: Record<SilkeFileCategory, string[]> = {
21
21
  'application/vnd.openxmlformats-officedocument.presentationml.presentation',
22
22
  'application/json',
23
23
  ],
24
+ // Documents AI models can read, unlike the Office files listed under `text`
25
+ document: ['application/pdf', 'text/plain', 'text/markdown', 'text/csv', 'application/json'],
26
+ // 3D models: glTF binary (.glb) and JSON (.gltf)
27
+ '3d': ['model/gltf-binary', 'model/gltf+json'],
28
+ };
29
+
30
+ /** MIME type of each document extension, for files the browser reports without a usable type */
31
+ const MIME_TYPE_BY_EXTENSION = new Map<string, string>([
32
+ ['pdf', 'application/pdf'],
33
+ ['txt', 'text/plain'],
34
+ ['md', 'text/markdown'],
35
+ ['markdown', 'text/markdown'],
36
+ ['csv', 'text/csv'],
37
+ ['json', 'application/json'],
38
+ ['glb', 'model/gltf-binary'],
39
+ ['gltf', 'model/gltf+json'],
40
+ ]);
41
+
42
+ /**
43
+ * Types browsers report for documents instead of their real one: none at all (`.md` on Windows),
44
+ * a generic binary type, or an alias (`.csv` comes as Excel's type on Windows).
45
+ */
46
+ const ALIAS_MIME_TYPES = new Set([
47
+ '',
48
+ 'application/octet-stream',
49
+ 'application/vnd.ms-excel',
50
+ 'application/csv',
51
+ 'text/x-csv',
52
+ 'text/x-markdown',
53
+ ]);
54
+
55
+ /**
56
+ * Extensions added to the file picker's `accept` per category, so the OS picker still offers
57
+ * files whose MIME type it does not know.
58
+ */
59
+ const FILE_CATEGORY_EXTENSIONS: Partial<Record<SilkeFileCategory, string[]>> = {
60
+ document: ['.pdf', '.txt', '.md', '.markdown', '.csv', '.json'],
61
+ '3d': ['.glb', '.gltf'],
24
62
  };
25
63
 
26
64
  /** Resolve file categories to a flat list of MIME patterns */
@@ -28,6 +66,23 @@ export function resolveFileCategories(categories: SilkeFileCategory[]): string[]
28
66
  return categories.flatMap((cat) => FILE_CATEGORY_PATTERNS[cat] ?? []);
29
67
  }
30
68
 
69
+ /** Resolve file categories to a file input's `accept` attribute: MIME patterns, then extensions */
70
+ export function resolveFileAccept(categories: SilkeFileCategory[]): string {
71
+ const extensions = categories.flatMap((cat) => FILE_CATEGORY_EXTENSIONS[cat] ?? []);
72
+ return Array.from(new Set([...resolveFileCategories(categories), ...extensions])).join(',');
73
+ }
74
+
75
+ /**
76
+ * The MIME type of a file, falling back to its extension when the browser reports none or an
77
+ * alias (an empty `.md`, a `.csv` typed as Excel). Unknown extensions keep the reported type.
78
+ */
79
+ export function inferMimeType(file: File): string {
80
+ if (!ALIAS_MIME_TYPES.has(file.type)) return file.type;
81
+ const dotIndex = file.name.lastIndexOf('.');
82
+ if (dotIndex < 0) return file.type;
83
+ return MIME_TYPE_BY_EXTENSION.get(file.name.slice(dotIndex + 1).toLowerCase()) ?? file.type;
84
+ }
85
+
31
86
  /**
32
87
  * Check if a MIME type matches a set of MIME patterns.
33
88
  * Supports exact matches ('text/csv') and wildcard subtypes ('image/*').
@@ -53,7 +108,8 @@ export function fileToAttachmentValue(
53
108
  acceptedTypes: string[],
54
109
  ): Promise<SilkeImageValue | SilkeFileValue | null> {
55
110
  return new Promise((resolve) => {
56
- if (!matchesMimePattern(file.type, acceptedTypes)) {
111
+ const mimeType = inferMimeType(file);
112
+ if (!matchesMimePattern(mimeType, acceptedTypes)) {
57
113
  resolve(null);
58
114
  return;
59
115
  }
@@ -64,18 +120,18 @@ export function fileToAttachmentValue(
64
120
  if (typeof result === 'string') {
65
121
  const [, base64Data] = result.split(',');
66
122
 
67
- if (file.type.startsWith('image/')) {
123
+ if (mimeType.startsWith('image/')) {
68
124
  resolve({
69
125
  type: 'image',
70
126
  data: base64Data,
71
- mimeType: file.type,
127
+ mimeType,
72
128
  name: file.name || undefined,
73
129
  });
74
130
  } else {
75
131
  resolve({
76
132
  type: 'file',
77
133
  data: base64Data,
78
- mimeType: file.type,
134
+ mimeType,
79
135
  name: file.name || 'Untitled',
80
136
  });
81
137
  }
@@ -89,45 +145,69 @@ export function fileToAttachmentValue(
89
145
  }
90
146
 
91
147
  /**
92
- * Extract the first matching file from a ClipboardEvent given accepted MIME patterns.
148
+ * Reads several Files with fileToAttachmentValue, leaving out the ones that are not accepted or
149
+ * cannot be read.
93
150
  */
94
- export function getFileFromClipboard(
95
- e: React.ClipboardEvent,
151
+ export async function filesToAttachmentValues(
152
+ files: File[],
96
153
  acceptedTypes: string[],
97
- ): File | null {
154
+ ): Promise<(SilkeImageValue | SilkeFileValue)[]> {
155
+ const results = await Promise.all(
156
+ files.map((file) => fileToAttachmentValue(file, acceptedTypes)),
157
+ );
158
+ return results.filter((v): v is SilkeImageValue | SilkeFileValue => v !== null);
159
+ }
160
+
161
+ /**
162
+ * Extract every matching file from a ClipboardEvent given accepted MIME patterns.
163
+ */
164
+ export function getFilesFromClipboard(e: React.ClipboardEvent, acceptedTypes: string[]): File[] {
98
165
  const items = e.clipboardData?.items;
99
- if (!items) return null;
166
+ if (!items) return [];
100
167
 
168
+ const files: File[] = [];
101
169
  for (const item of items) {
102
- if (matchesMimePattern(item.type, acceptedTypes)) {
103
- return item.getAsFile();
170
+ // The item's own type is the browser's raw one, so infer from the File instead
171
+ const file = item.kind === 'file' ? item.getAsFile() : null;
172
+ if (file && matchesMimePattern(inferMimeType(file), acceptedTypes)) {
173
+ files.push(file);
104
174
  }
105
175
  }
106
- return null;
176
+ return files;
107
177
  }
108
178
 
109
179
  /**
110
- * Extract the first matching file from a DragEvent given accepted MIME patterns.
180
+ * Extract the first matching file from a ClipboardEvent given accepted MIME patterns.
111
181
  */
112
- export function getFileFromDragEvent(
113
- e: DragEvent,
182
+ export function getFileFromClipboard(
183
+ e: React.ClipboardEvent,
114
184
  acceptedTypes: string[],
115
185
  ): File | null {
186
+ return getFilesFromClipboard(e, acceptedTypes)[0] ?? null;
187
+ }
188
+
189
+ /**
190
+ * Extract every matching file from a DragEvent given accepted MIME patterns.
191
+ */
192
+ export function getFilesFromDragEvent(e: DragEvent, acceptedTypes: string[]): File[] {
116
193
  const files = e.dataTransfer?.files;
117
- if (!files || files.length === 0) return null;
194
+ if (!files) return [];
118
195
 
119
- for (const file of files) {
120
- if (matchesMimePattern(file.type, acceptedTypes)) {
121
- return file;
122
- }
123
- }
124
- return null;
196
+ return Array.from(files).filter((file) => matchesMimePattern(inferMimeType(file), acceptedTypes));
197
+ }
198
+
199
+ /**
200
+ * Extract the first matching file from a DragEvent given accepted MIME patterns.
201
+ */
202
+ export function getFileFromDragEvent(e: DragEvent, acceptedTypes: string[]): File | null {
203
+ return getFilesFromDragEvent(e, acceptedTypes)[0] ?? null;
125
204
  }
126
205
 
127
206
  /**
128
207
  * Maps a MIME type to a SilkeIcon key for display.
129
208
  */
130
209
  export function getFileIcon(mimeType: string): SilkeIcons {
210
+ if (mimeType.startsWith('model/')) return 'package';
131
211
  if (mimeType === 'application/pdf') return 'file';
132
212
  if (
133
213
  mimeType === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
@@ -5,6 +5,9 @@ export {
5
5
  fileToAttachmentValue,
6
6
  getFileFromClipboard,
7
7
  getFileFromDragEvent,
8
+ getFilesFromClipboard,
9
+ getFilesFromDragEvent,
10
+ inferMimeType,
8
11
  matchesMimePattern,
9
12
  resolveFileCategories,
10
13
  } from './file-utils';
@@ -327,7 +327,7 @@ const availableCommands = [
327
327
  | `availableCommands` | `SilkeCommand[]` | Required | List of valid commands for autocomplete and validation |
328
328
  | `value` | `SilkeCommandTextFieldValue[]` | Required | Current value of the field |
329
329
  | `onChange` | `(value: SilkeCommandTextFieldValue[]) => void` | Required | Called when the value changes |
330
- | `acceptedFileTypes` | `SilkeFileCategory[]` | `[]` | File categories to accept: `'image'` and/or `'text'` |
330
+ | `acceptedFileTypes` | `SilkeFileCategory[]` | `[]` | File categories to accept: `'image'`, `'text'`, `'document'` and/or `'3d'` |
331
331
  | `onSuggestions` | `(suggestions: SilkeCommand[]) => void` | - | Called with matching suggestions when typing a partial command |
332
332
  | `onCommandFocus` | `(index: number, command?: SilkeCommandTextFieldValue) => void` | - | Called when the active command changes |
333
333
  | `onKeyDown` | `(e: React.KeyboardEvent) => void` | - | Called on key down events |
@@ -395,3 +395,7 @@ The `acceptedFileTypes` prop accepts an array of category strings:
395
395
  | -------- | ------------------- |
396
396
  | `'image'` | All image types (PNG, JPEG, GIF, WebP, SVG, etc.) |
397
397
  | `'text'` | PDF, Word (.doc/.docx), Excel (.xls/.xlsx), PowerPoint (.ppt/.pptx), CSV, plain text, Markdown, HTML, JSON |
398
+ | `'document'` | Documents AI models can read: PDF, plain text, Markdown, CSV, JSON |
399
+ | `'3d'` | 3D models: glTF binary (.glb) and glTF JSON (.gltf) |
400
+
401
+ Files the browser reports without a type, or with an alias (`.md` on Windows, a `.csv` typed as Excel), are recognised by their extension. Pasting or dropping several files adds them all.
@@ -16,9 +16,10 @@ import {
16
16
  import { AttachmentList, AttachmentListHandle } from './attachment-list';
17
17
  import {
18
18
  SilkeFileCategory,
19
- fileToAttachmentValue,
20
- getFileFromClipboard,
21
- getFileFromDragEvent,
19
+ filesToAttachmentValues,
20
+ getFilesFromClipboard,
21
+ getFilesFromDragEvent,
22
+ resolveFileAccept,
22
23
  resolveFileCategories,
23
24
  } from './file-utils';
24
25
  import { parseTextToSilkeCommands } from './silke-command-parser';
@@ -49,6 +50,7 @@ export type SilkeCommandTextFieldProps = SilkeTextFieldOutlineProps & {
49
50
  * File type categories to accept as attachments.
50
51
  * - `'image'` — all image types (png, jpeg, gif, etc.)
51
52
  * - `'text'` — documents and text files (PDF, Word, Excel, CSV, TXT, JSON, etc.)
53
+ * - `'document'` — documents AI models can read (PDF, TXT, Markdown, CSV, JSON)
52
54
  * Defaults to `[]` (no files accepted).
53
55
  */
54
56
  acceptedFileTypes?: SilkeFileCategory[];
@@ -127,6 +129,7 @@ const SilkeCommandTextField = React.forwardRef<
127
129
  () => resolveFileCategories(acceptedFileTypes ?? []),
128
130
  [acceptedFileTypes],
129
131
  );
132
+ const fileAccept = useMemo(() => resolveFileAccept(acceptedFileTypes ?? []), [acceptedFileTypes]);
130
133
 
131
134
  const filesDisabled = effectiveAcceptedTypes.length === 0;
132
135
 
@@ -393,11 +396,7 @@ const SilkeCommandTextField = React.forwardRef<
393
396
  );
394
397
 
395
398
  const handleCharacterInput = useCallback(
396
- (
397
- e: React.KeyboardEvent,
398
- commandIndex: number,
399
- currentValue: SilkeCommandTextFieldValue[],
400
- ) => {
399
+ (e: React.KeyboardEvent, commandIndex: number, currentValue: SilkeCommandTextFieldValue[]) => {
401
400
  const element = inputRef.current;
402
401
  if (!element) return;
403
402
 
@@ -514,15 +513,6 @@ const SilkeCommandTextField = React.forwardRef<
514
513
  [disabled, handleArrowNavigation, handleCharacterInput, handleDelete, onKeyDown],
515
514
  );
516
515
 
517
- const addAttachment = useCallback(
518
- (attachmentValue: SilkeImageValue | SilkeFileValue) => {
519
- const newValue = [...valueRef.current, attachmentValue];
520
- onChange(newValue);
521
- inputRef.current?.focus();
522
- },
523
- [onChange],
524
- );
525
-
526
516
  const removeAttachment = useCallback(
527
517
  (index: number) => {
528
518
  // Find the nth attachment in the value array and remove it
@@ -550,15 +540,23 @@ const SilkeCommandTextField = React.forwardRef<
550
540
  [onChange],
551
541
  );
552
542
 
543
+ // Read pasted or dropped files and add them in one change, so several arrive at once
544
+ const addFiles = useCallback(
545
+ (files: File[]) => {
546
+ filesToAttachmentValues(files, effectiveAcceptedTypes).then((attachmentValues) => {
547
+ if (attachmentValues.length > 0) addMultipleAttachments(attachmentValues);
548
+ });
549
+ },
550
+ [addMultipleAttachments, effectiveAcceptedTypes],
551
+ );
552
+
553
553
  const handlePaste = useCallback(
554
554
  (e: React.ClipboardEvent<HTMLDivElement>) => {
555
555
  if (!filesDisabled) {
556
- const file = getFileFromClipboard(e, effectiveAcceptedTypes);
557
- if (file) {
556
+ const files = getFilesFromClipboard(e, effectiveAcceptedTypes);
557
+ if (files.length > 0) {
558
558
  e.preventDefault();
559
- fileToAttachmentValue(file, effectiveAcceptedTypes).then((attachmentValue) => {
560
- if (attachmentValue) addAttachment(attachmentValue);
561
- });
559
+ addFiles(files);
562
560
  return;
563
561
  }
564
562
  }
@@ -587,7 +585,7 @@ const SilkeCommandTextField = React.forwardRef<
587
585
  // execCommand fires `input`, the manual path does not, so re-parse from the DOM either way.
588
586
  handleInput({ currentTarget: e.currentTarget } as React.FormEvent<HTMLDivElement>);
589
587
  },
590
- [addAttachment, effectiveAcceptedTypes, filesDisabled, handleInput],
588
+ [addFiles, effectiveAcceptedTypes, filesDisabled, handleInput],
591
589
  );
592
590
 
593
591
  const containerRef = useRef<HTMLDivElement>(null);
@@ -596,14 +594,12 @@ const SilkeCommandTextField = React.forwardRef<
596
594
  (e: DragEvent) => {
597
595
  if (filesDisabled) return;
598
596
 
599
- const file = getFileFromDragEvent(e, effectiveAcceptedTypes);
600
- if (!file) return;
597
+ const files = getFilesFromDragEvent(e, effectiveAcceptedTypes);
598
+ if (files.length === 0) return;
601
599
 
602
- fileToAttachmentValue(file, effectiveAcceptedTypes).then((attachmentValue) => {
603
- if (attachmentValue) addAttachment(attachmentValue);
604
- });
600
+ addFiles(files);
605
601
  },
606
- [addAttachment, effectiveAcceptedTypes, filesDisabled],
602
+ [addFiles, effectiveAcceptedTypes, filesDisabled],
607
603
  );
608
604
 
609
605
  useDropZone(containerRef, handleDrop);
@@ -618,6 +614,7 @@ const SilkeCommandTextField = React.forwardRef<
618
614
  {!filesDisabled && (
619
615
  <AttachmentList
620
616
  ref={attachmentListRef}
617
+ accept={fileAccept}
621
618
  acceptedTypes={effectiveAcceptedTypes}
622
619
  attachments={attachments}
623
620
  disabled={disabled}
@@ -13,7 +13,7 @@ export type SilkeConditionsInputProps = {
13
13
 
14
14
  export function SilkeConditionsInputOptions(props: SilkeConditionsInputProps) {
15
15
  const { suggestions, highlightedItem, onSelect } = props;
16
- const dropdownRef = useRef<HTMLElement>();
16
+ const dropdownRef = useRef<HTMLElement>(null);
17
17
 
18
18
  useEffect(() => {
19
19
  if (highlightedItem !== undefined) {