@fibery/ui-kit 1.42.0 → 2.0.1

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 (100) hide show
  1. package/.oxlintrc.json +24 -0
  2. package/CHANGELOG.md +20 -0
  3. package/eslint.config.mjs +1 -1
  4. package/jest.config.cjs +36 -0
  5. package/package.json +12 -52
  6. package/src/@types/css.d.ts +1 -0
  7. package/src/actions-menu/actions-menu-checkbox-item.tsx +74 -0
  8. package/src/actions-menu/contexts/actions-menu-context.tsx +1 -0
  9. package/src/actions-menu/index.tsx +1 -0
  10. package/src/animated-number.tsx +2 -2
  11. package/src/antd/AutoComplete.d.ts +1 -0
  12. package/src/app-icon-with-fallback.tsx +4 -4
  13. package/src/app-icon.tsx +4 -4
  14. package/src/appIcons.json +1227 -1227
  15. package/src/avatar.tsx +44 -5
  16. package/src/box.tsx +10 -17
  17. package/src/button/make-button-colors.ts +13 -13
  18. package/src/checkbox.tsx +3 -3
  19. package/src/collapsible-section.tsx +1 -1
  20. package/src/context-menu/index.tsx +4 -0
  21. package/src/date-picker/date-range-picker.tsx +1 -1
  22. package/src/date-picker/relative-date-picker.tsx +3 -0
  23. package/src/date-picker/single-date-picker.tsx +10 -9
  24. package/src/design-system/alpha.ts +9 -0
  25. package/src/design-system/colors-css.test.ts +1 -9
  26. package/src/design-system/colors-css.ts +1 -1
  27. package/src/design-system/colors.ts +351 -313
  28. package/src/design-system/layout.ts +1 -1
  29. package/src/design-system/theme.ts +4 -1
  30. package/src/design-system/vars.test.ts +4 -0
  31. package/src/design-system.test.ts +1 -0
  32. package/src/design-system.ts +1 -1
  33. package/src/dropdown-menu/index.tsx +4 -0
  34. package/src/emoji-picker/primitives/emoji.tsx +12 -0
  35. package/src/emoji-picker/primitives/grid.tsx +100 -104
  36. package/src/emoji.tsx +1 -0
  37. package/src/file-item.tsx +308 -265
  38. package/src/icons/ast/AddDatabase.ts +1 -1
  39. package/src/icons/ast/AddIntegration.ts +1 -1
  40. package/src/icons/ast/ArrowsRightLeft.ts +1 -1
  41. package/src/icons/ast/ChatBubble.ts +1 -1
  42. package/src/icons/ast/ChatFloat.ts +1 -1
  43. package/src/icons/ast/ChatSidebar.ts +1 -1
  44. package/src/icons/ast/Clean.ts +1 -1
  45. package/src/icons/ast/Create.ts +1 -1
  46. package/src/icons/ast/ItemsTimeline.ts +1 -1
  47. package/src/icons/ast/Key.ts +1 -1
  48. package/src/icons/ast/NetworkAdd.ts +1 -1
  49. package/src/icons/ast/Print.ts +1 -1
  50. package/src/icons/ast/Success.ts +1 -1
  51. package/src/icons/ast/SuggestIntegration.ts +1 -1
  52. package/src/icons/ast/WarningTriangle.ts +1 -1
  53. package/src/icons/ast/Windows.ts +1 -1
  54. package/src/icons/svg/add-database.svg +1 -1
  55. package/src/icons/svg/add-integration.svg +1 -1
  56. package/src/icons/svg/arrows-right-left.svg +1 -1
  57. package/src/icons/svg/chat-bubble.svg +1 -1
  58. package/src/icons/svg/chat-float.svg +1 -1
  59. package/src/icons/svg/chat-sidebar.svg +3 -3
  60. package/src/icons/svg/clean.svg +1 -1
  61. package/src/icons/svg/create.svg +1 -1
  62. package/src/icons/svg/items-timeline.svg +1 -1
  63. package/src/icons/svg/key.svg +1 -1
  64. package/src/icons/svg/network-add.svg +1 -1
  65. package/src/icons/svg/print.svg +1 -1
  66. package/src/icons/svg/success.svg +1 -1
  67. package/src/icons/svg/suggest-integration.svg +1 -1
  68. package/src/icons/svg/warning-triangle.svg +1 -1
  69. package/src/icons/svg/windows.svg +1 -1
  70. package/src/images-gallery/images-gallery.tsx +24 -0
  71. package/src/lists/actions-menu-row-surface.tsx +2 -1
  72. package/src/logo.tsx +14 -13
  73. package/src/modal-menu/index.tsx +1 -0
  74. package/src/modal-menu/modal-menu-checkbox-item.tsx +50 -0
  75. package/src/online-users.tsx +45 -46
  76. package/src/palettes/slate-arch.colors-snapshot.test.ts +7 -7
  77. package/src/palettes/slate-user.colors-snapshot.test.ts +11 -11
  78. package/src/palettes/warm-arch.colors-snapshot.test.ts +7 -7
  79. package/src/palettes/warm-user.colors-snapshot.test.ts +7 -7
  80. package/src/popover/index.tsx +91 -203
  81. package/src/popover/popover-old.tsx +113 -0
  82. package/src/popover/popup-modifiers-context.ts +1 -1
  83. package/src/scale-generator.ts +2 -2
  84. package/src/select/components/clear-indicator.tsx +1 -1
  85. package/src/select/components/drop-down-indicator.tsx +2 -2
  86. package/src/select/components/group-heading.tsx +2 -2
  87. package/src/select/components/menu-list-virtualized.tsx +1 -1
  88. package/src/select/components/option.tsx +1 -1
  89. package/src/select/index.tsx +34 -37
  90. package/src/select/select-in-popover.tsx +34 -202
  91. package/src/select/select.tsx +5 -4
  92. package/src/select/styles.ts +3 -0
  93. package/src/thematic-state.ts +1 -1
  94. package/src/theme-provider.tsx +14 -2
  95. package/src/theme-styles.ts +14 -7
  96. package/src/toggle-button/toggle-button.tsx +48 -35
  97. package/src/tree-utils.test.ts +166 -0
  98. package/src/tree-utils.ts +107 -0
  99. package/src/file-item/use-register-in-image-gallery.tsx +0 -70
  100. package/src/file-item-2.tsx +0 -357
package/src/file-item.tsx CHANGED
@@ -1,322 +1,365 @@
1
1
  import {css, cx} from "@linaria/core";
2
- import {useCallback, useEffect, useState} from "react";
3
- import {ActionsMenu, ActionsMenuItem} from "./actions-menu";
2
+ import {CSSProperties, useState} from "react";
3
+ import {ActionsMenu} from "./actions-menu";
4
4
  import {ActionsButtonCompact} from "./button/actions-button-compact";
5
- import {Item} from "./item";
6
- import {border, fontWeight, space, textStyles, themeVars} from "./design-system";
5
+ import {border, fontSize, fontWeight, lineHeight, space, themeVars} from "./design-system";
7
6
  import {makeButtonColors} from "./button/make-button-colors";
8
7
  import {useTheme} from "./theme-provider";
9
- import {useImagesGalleryMethods, useImagesGalleryRegistry} from "./images-gallery/images-gallery";
10
- import FileDownload from "./icons/react/FileDownload";
11
- import RicheditorOpenLink from "./icons/react/RicheditorOpenLink";
12
- import Delete from "./icons/react/Delete";
13
- import Link from "./icons/react/Link";
14
- import Pencil from "./icons/react/Pencil";
15
- import {copyToClipboard} from "./copy-to-clipboard";
16
- import {useToast} from "./toast/toast-provider";
17
- import {isPhoneApp} from "./use-is-phone";
8
+ import Spinner from "./icons/react/Spinner";
9
+ import {Icon} from "./icons/Icon";
10
+ import {FileIcon} from "./file-item/file-icon";
11
+ import {FileMenuItems} from "./file-item/file-menu-items";
12
+ import {UploadFileWithContent} from "./file-item/types";
13
+ import {FileTitle as FileTitleInner} from "./file-item/file-title";
18
14
 
19
15
  const fileItemStyle = css`
20
- ${{
21
- display: "block",
22
- height: "100%",
23
- backgroundColor: themeVars.entityCardBgColor,
24
- backgroundSize: "cover",
25
- textDecoration: "none",
26
- borderRadius: border.radius6,
27
- boxShadow: themeVars.entityCardShadow,
28
- "&:focus": {textDecoration: "none"},
29
- }}
16
+ display: block;
17
+ height: 100%;
18
+ background-color: ${themeVars.transparent};
19
+ background-size: cover;
20
+ text-decoration: none;
21
+ border-radius: ${space.s8}px;
22
+ background-clip: padding-box;
23
+ &:focus {
24
+ text-decoration: none;
25
+ }
30
26
  `;
31
27
 
32
- const overlayStyle = css`
33
- ${{
34
- width: "100%",
35
- height: "100%",
36
- padding: space.s12,
37
- overflow: "hidden",
38
- color: themeVars.textColor,
39
- borderRadius: border.radius6,
40
- }}
28
+ const thumbnailStyle = css`
29
+ border: 1px solid ${themeVars.separatorColor};
41
30
  `;
42
31
 
43
- const nameStyle = css`
44
- ${{
45
- wordBreak: "break-word",
46
- textDecoration: "none",
47
- height: textStyles.regular.fontSize * textStyles.regular.lineHeight * 5,
48
- overflow: "hidden",
49
- marginTop: space.s2,
50
- }}
32
+ const iconOnlyStyle = css`
33
+ border: 1px solid ${themeVars.colorBorderButtonOutlineNeutralDefault};
34
+ `;
35
+
36
+ const overlayStyle = css`
37
+ width: 100%;
38
+ height: 100%;
39
+ padding: ${space.s8}px;
40
+ overflow: hidden;
41
+ color: ${themeVars.textColor};
42
+ border-radius: ${border.radius8}px;
43
+ cursor: pointer;
44
+ opacity: 0;
51
45
  `;
52
46
 
53
47
  const imageOverlayStyle = css`
54
- ${{
55
- background: "linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0) 100%)",
56
- backgroundSize: "100% 200%",
57
- backgroundPosition: "0 100%",
58
- transition: "0.2s all ease-in-out",
59
- color: themeVars.transparent,
60
- borderRadius: border.radius6,
61
- "&:hover": {
62
- backgroundPosition: "0% 0%",
63
- color: themeVars.inversedTextColor,
64
- },
65
- }}
48
+ background-size: 100% 200%;
49
+ background-position: 0 100%;
50
+ color: ${themeVars.transparent};
51
+ border-radius: ${border.radius6}px;
52
+ &:hover {
53
+ background-position: 0 0;
54
+ color: ${themeVars.inversedTextColor};
55
+ }
66
56
  `;
67
57
 
68
58
  const fileOverlayStyle = css`
69
- ${{
70
- background: "transparent",
71
- }}
59
+ opacity: 1;
60
+ background: transparent;
72
61
  `;
73
62
 
74
- export type FileItemType = {
75
- uid: string;
76
- name: string;
77
- url: string;
78
- thumbnailUrl: string | null;
79
- previewData: null | {
80
- type: "image" | "video" | "iframe";
81
- previewSrc: string | null;
82
- originalSrc: string;
83
- contentType: string;
84
- };
85
- downloadUrl?: string | null;
86
- status?: string;
87
- };
63
+ const actionsButtonStyle = css`
64
+ position: absolute;
65
+ top: ${space.s8}px;
66
+ right: ${space.s8}px;
67
+ opacity: 0;
68
+ `;
88
69
 
89
70
  export type FileItemProps = {
90
- data: FileItemType;
71
+ data: UploadFileWithContent;
91
72
  onDownloadClick?: () => void;
92
- onRemoveClick?: (x: FileItemType) => void;
73
+ onRemoveClick?: () => void;
74
+ onRenameClick?: (file: {id: string; name: string}) => void;
75
+ onClick?: () => void;
93
76
  disabled?: boolean;
94
- onRenameClick?: (p: {id: string; name: string}) => void;
95
77
  };
96
78
 
79
+ export const minFileTileWidth = 120;
80
+
97
81
  export function FileItem(props: FileItemProps) {
98
82
  const theme = useTheme();
99
- const {onDownloadClick, onRemoveClick} = props;
100
- const {name, url, thumbnailUrl, status, previewData: preview} = props.data;
101
- const isActive = status === "uploading" || status === "deleting";
102
- const isBackgroundReady = thumbnailUrl && !isActive;
103
-
104
- const [zoomed, setZoomed] = useState(false);
105
- const imagesRegistry = useImagesGalleryRegistry();
106
- const galleryMethods = useImagesGalleryMethods();
83
+ const {onDownloadClick, onRemoveClick, onClick} = props;
84
+ const {name, thumbnailUrl, status, contentType} = props.data;
85
+ const isPending = status === "uploading" || status === "deleting";
86
+ const [isThumbnailLoadFailed, setIsThumbnailLoadFailed] = useState(false);
87
+ const isBackgroundReady = !isThumbnailLoadFailed && Boolean(thumbnailUrl && !isPending);
88
+ const [isActionsOpened, setIsActionsOpened] = useState(false);
107
89
 
108
- useEffect(() => {
109
- if (!preview) {
110
- return undefined;
111
- }
112
-
113
- imagesRegistry.set(preview.originalSrc, {
114
- type: preview.type,
115
- src: preview.originalSrc,
116
- label: name,
117
- contentType: preview.contentType,
118
- zoomed: false,
119
- setZoomed,
120
- actions: <FilePreviewActions url={preview.originalSrc} name={name} onDownloadClick={onDownloadClick} />,
121
- });
122
- return () => {
123
- imagesRegistry.delete(preview.originalSrc);
124
- };
125
- }, [imagesRegistry, name, preview, onDownloadClick]);
126
-
127
- useEffect(() => {
128
- if (!preview) {
129
- return;
130
- }
131
-
132
- if (zoomed) {
133
- galleryMethods.setActivated(true);
134
- }
135
- const imageData = imagesRegistry.get(preview.originalSrc);
136
- if (imageData) {
137
- imageData.zoomed = zoomed;
138
- } else {
139
- imagesRegistry.set(preview.originalSrc, {
140
- type: preview.type,
141
- src: preview.originalSrc,
142
- label: name,
143
- contentType: preview.contentType,
144
- zoomed,
145
- setZoomed,
146
- actions: <FilePreviewActions url={preview.originalSrc} name={name} onDownloadClick={onDownloadClick} />,
147
- });
148
- }
149
- }, [galleryMethods, zoomed, preview, imagesRegistry, name, onDownloadClick]);
150
-
151
- const onContainerClick = useCallback(() => {
152
- if (preview) {
153
- setZoomed(true);
154
- } else {
155
- onDownloadClick?.();
156
- }
157
- }, [preview, onDownloadClick]);
90
+ const showFileIcon = !isPending && !isBackgroundReady;
158
91
 
159
92
  return (
160
- <div
161
- className={cx(
162
- css`
163
- position: relative;
164
- height: 100%;
165
- cursor: pointer;
166
- `,
167
- isBackgroundReady &&
168
- css`
169
- &:hover .${overlayStyle} {
170
- background-position: 0 0;
171
- color: ${themeVars.inversedTextColor};
172
- }
173
- `
174
- )}
175
- >
93
+ <>
176
94
  <div
177
- style={isBackgroundReady ? {backgroundImage: `url(${thumbnailUrl})`} : {}}
178
- onClick={onContainerClick}
179
95
  className={cx(
180
- fileItemStyle,
181
- isActive &&
96
+ css`
97
+ flex: 1 0 0;
98
+ height: 100%;
99
+ min-width: ${minFileTileWidth}px;
100
+ `,
101
+ isBackgroundReady &&
182
102
  css`
183
- ${{backgroundColor: themeVars.entityCardSelectedColor}}
103
+ &:hover .${overlayStyle} {
104
+ opacity: 1;
105
+ background-position: 0 0;
106
+ color: ${themeVars.whiteColor};
107
+ background-color: rgba(0, 0, 0, 0.6);
108
+ }
109
+ `,
110
+ isBackgroundReady &&
111
+ isActionsOpened &&
112
+ css`
113
+ .${overlayStyle} {
114
+ opacity: 1;
115
+ background-position: 0 0;
116
+ color: ${themeVars.whiteColor};
117
+ background-color: rgba(0, 0, 0, 0.6);
118
+ }
119
+ `,
120
+ !isBackgroundReady &&
121
+ css`
122
+ &:hover .${overlayStyle} {
123
+ background-color: ${themeVars.colorBgMenuItemHover};
124
+ }
125
+ &:hover .${actionsButtonStyle} {
126
+ opacity: 1;
127
+ }
128
+ `,
129
+ !isBackgroundReady &&
130
+ isActionsOpened &&
131
+ css`
132
+ .${overlayStyle} {
133
+ background-color: ${themeVars.colorBgMenuItemHover};
134
+ }
135
+ .${actionsButtonStyle} {
136
+ opacity: 1;
137
+ }
184
138
  `
185
139
  )}
186
140
  >
187
- <div className={cx(overlayStyle, isBackgroundReady ? imageOverlayStyle : fileOverlayStyle)}>
188
- <Item
189
- multiline
190
- textClassName={nameStyle}
191
- rightContainer={
141
+ <div
142
+ style={isBackgroundReady ? {backgroundImage: `url(${thumbnailUrl})`} : {}}
143
+ onClick={onClick}
144
+ className={cx(
145
+ css`
146
+ flex-shrink: 0;
147
+ `,
148
+ fileItemStyle,
149
+ showFileIcon ? iconOnlyStyle : thumbnailStyle,
150
+ isPending &&
151
+ css`
152
+ ${{backgroundColor: themeVars.entityCardSelectedColor}}
153
+ `
154
+ )}
155
+ >
156
+ {isPending && (
157
+ <div
158
+ className={css`
159
+ display: flex;
160
+ flex-direction: column;
161
+ justify-content: center; /* centers vertically */
162
+ align-items: center; /* centers horizontally */
163
+ height: 100%;
164
+ width: 100%;
165
+ `}
166
+ >
167
+ <Spinner />
168
+ </div>
169
+ )}
170
+ {showFileIcon && (
171
+ <div
172
+ className={cx(
173
+ overlayStyle,
174
+ fileOverlayStyle,
175
+ css`
176
+ position: relative;
177
+ `
178
+ )}
179
+ >
192
180
  <div
193
181
  className={css`
194
182
  display: flex;
195
- align-items: center;
196
- gap: ${space.s4}px;
183
+ flex-direction: column;
184
+ justify-content: center; /* centers vertically */
185
+ align-items: center; /* centers horizontally */
186
+ height: 100%;
187
+ width: 100%;
188
+ padding-top: ${space.s1}px;
189
+ gap: ${space.s2}px;
197
190
  `}
198
191
  >
199
- <ActionsMenu
200
- trigger={
201
- <ActionsButtonCompact
202
- className={css`
203
- z-index: 1;
204
- `}
205
- style={
206
- isBackgroundReady ? makeButtonColors(themeVars.inversedTextColor, "ghost", theme) : undefined
207
- }
208
- />
209
- }
192
+ <Icon containerSize={40} iconSize={40}>
193
+ <FileIcon contentType={contentType} />
194
+ </Icon>
195
+ <div
196
+ className={css`
197
+ display: flex;
198
+ width: 100%;
199
+ justify-content: center;
200
+ gap: 10px;
201
+ flex-shrink: 0;
202
+ color: ${themeVars.colorTextMenuItem};
203
+ text-overflow: ellipsis;
204
+ overflow: hidden;
205
+ `}
210
206
  >
211
- <CopyFileUrlActionMenuItem url={url} />
212
- <a href={url} target="_blank" rel="noopener noreferrer">
213
- <ActionsMenuItem Icon={RicheditorOpenLink}>Open in new tab</ActionsMenuItem>
214
- </a>
215
- {isPhoneApp() ? (
216
- <ActionsMenuItem Icon={FileDownload} onSelect={onDownloadClick}>
217
- Download
218
- </ActionsMenuItem>
219
- ) : (
220
- <a download={name} href={props.data.downloadUrl ?? url}>
221
- <ActionsMenuItem Icon={FileDownload}>Download</ActionsMenuItem>
222
- </a>
223
- )}
224
- {props.onRenameClick && status === "done" ? (
225
- <ActionsMenuItem
226
- Icon={Pencil}
227
- onSelect={() => props.onRenameClick?.({id: props.data.uid, name: props.data.name})}
228
- >
229
- Rename
230
- </ActionsMenuItem>
231
- ) : null}
232
- <ActionsMenuItem
233
- Icon={Delete}
234
- onSelect={() => onRemoveClick?.(props.data)}
235
- dangerous
207
+ <FileTitle
208
+ title={name}
209
+ className={css`
210
+ overflow: hidden;
211
+ text-overflow: ellipsis;
212
+ `}
213
+ />
214
+ </div>
215
+ </div>
216
+ <div className={actionsButtonStyle}>
217
+ <FileActionsMenu
218
+ setIsActionsOpened={setIsActionsOpened}
219
+ data={props.data}
220
+ disabled={props.disabled}
221
+ onDownloadClick={onDownloadClick}
222
+ onRemoveClick={onRemoveClick}
223
+ onRenameClick={props.onRenameClick}
224
+ />
225
+ </div>
226
+ </div>
227
+ )}
228
+ {!isPending && !showFileIcon && (
229
+ <div className={cx(overlayStyle, isBackgroundReady ? imageOverlayStyle : fileOverlayStyle)}>
230
+ <div
231
+ className={css`
232
+ position: relative;
233
+ display: flex;
234
+ flex-direction: column;
235
+ justify-content: space-between; /* Top + bottom placement */
236
+ width: 100%;
237
+ height: 100%;
238
+ overflow: hidden;
239
+ box-sizing: border-box;
240
+ gap: ${space.s8}px;
241
+ `}
242
+ >
243
+ <div
244
+ className={css`
245
+ align-self: flex-end;
246
+ `}
247
+ >
248
+ <FileActionsMenu
249
+ setIsActionsOpened={setIsActionsOpened}
250
+ data={props.data}
236
251
  disabled={props.disabled}
237
- >
238
- Delete
239
- </ActionsMenuItem>
240
- </ActionsMenu>
252
+ actionsButtonStyle={
253
+ isBackgroundReady ? makeButtonColors(themeVars.inversedTextColor, "ghost", theme) : undefined
254
+ }
255
+ onDownloadClick={onDownloadClick}
256
+ onRemoveClick={props.onRemoveClick}
257
+ onRenameClick={props.onRenameClick}
258
+ />
259
+ </div>
260
+ <div
261
+ className={css`
262
+ display: flex;
263
+ width: 100%;
264
+ align-self: flex-start;
265
+ align-items: flex-end;
266
+ text-overflow: ellipsis;
267
+ box-sizing: border-box;
268
+ `}
269
+ >
270
+ <FileTitle title={name} />
271
+ </div>
241
272
  </div>
242
- }
243
- >
244
- <div
245
- className={css`
246
- ${fontWeight}
247
- `}
248
- >
249
- <b>{resolveStatusText(props.data.status)}</b>
250
273
  </div>
251
- <span
252
- className={css`
253
- position: relative;
254
- z-index: 1;
255
- color: inherit;
256
- text-decoration: none;
257
- `}
258
- >
259
- {name}
260
- </span>
261
- </Item>
274
+ )}
262
275
  </div>
276
+ {thumbnailUrl ? (
277
+ <img
278
+ style={{display: "none"}}
279
+ onError={() => setIsThumbnailLoadFailed(true)}
280
+ src={thumbnailUrl}
281
+ alt="invisible"
282
+ />
283
+ ) : null}
263
284
  </div>
264
- </div>
285
+ </>
265
286
  );
266
287
  }
267
288
 
268
- function CopyFileUrlActionMenuItem({url}: {url: string}) {
269
- const toast = useToast();
289
+ function FileActionsMenu({
290
+ data,
291
+ disabled,
292
+ setIsActionsOpened,
293
+ onDownloadClick,
294
+ onRemoveClick,
295
+ onRenameClick,
296
+ actionsButtonStyle,
297
+ }: {
298
+ data: UploadFileWithContent;
299
+ onDownloadClick?: () => void;
300
+ onRemoveClick?: () => void;
301
+ onRenameClick?: (data: {id: string; name: string}) => void;
302
+ disabled?: boolean;
303
+ setIsActionsOpened: (val: boolean) => void;
304
+ actionsButtonStyle?: CSSProperties;
305
+ }) {
270
306
  return (
271
- <ActionsMenuItem
272
- Icon={Link}
273
- onSelect={() => {
274
- copyToClipboard(new URL(url, `${window.location}`).href)
275
- .then(() => toast.success({title: "Link copied to clipboard"}))
276
- .catch((error) => toast.error({title: "Unable to copy link to clipboard", subTitle: error.message}));
277
- }}
307
+ <ActionsMenu
308
+ onOpenChange={setIsActionsOpened}
309
+ trigger={
310
+ <ActionsButtonCompact
311
+ className={css`
312
+ z-index: 1;
313
+ `}
314
+ style={actionsButtonStyle}
315
+ />
316
+ }
278
317
  >
279
- Copy file URL
280
- </ActionsMenuItem>
318
+ {
319
+ <FileMenuItems
320
+ file={data}
321
+ disabled={disabled}
322
+ onDownloadClick={onDownloadClick}
323
+ onRemoveClick={onRemoveClick}
324
+ onRenameClick={onRenameClick}
325
+ />
326
+ }
327
+ </ActionsMenu>
281
328
  );
282
329
  }
283
330
 
284
- function resolveStatusText(status?: string) {
285
- if (status === "done" || status === "remove-error") {
286
- return "";
287
- }
288
- let statusText = `status=${status}`;
289
- if (status === "deleting") {
290
- statusText = "Deleting…";
291
- }
292
- if (status === "uploading") {
293
- statusText = "Uploading…";
294
- }
295
- return statusText;
296
- }
297
-
298
- function FilePreviewActions({url, name, onDownloadClick}: {url: string; name: string; onDownloadClick?: () => void}) {
299
- if (isPhoneApp()) {
300
- return (
301
- <>
302
- <a href={url} target="_blank" rel="noopener noreferrer">
303
- <ActionsMenuItem Icon={RicheditorOpenLink}>Open in browser</ActionsMenuItem>
304
- </a>
305
- <ActionsMenuItem Icon={FileDownload} onSelect={onDownloadClick}>
306
- Download
307
- </ActionsMenuItem>
308
- </>
309
- );
310
- }
311
-
331
+ function FileTitle({title, className}: {title: string; className?: string}) {
312
332
  return (
313
- <>
314
- <a href={url} target="_blank" rel="noopener noreferrer">
315
- <ActionsMenuItem Icon={RicheditorOpenLink}>Open in new tab</ActionsMenuItem>
316
- </a>
317
- <a download={name} href={`${url}/attachment`}>
318
- <ActionsMenuItem Icon={FileDownload}>Download</ActionsMenuItem>
319
- </a>
320
- </>
333
+ <div
334
+ className={cx(
335
+ css`
336
+ border-radius: ${border.radius4}px;
337
+ background: ${themeVars.badgeBgColor};
338
+ padding: ${space.s2}px ${space.s5}px;
339
+ height: 100%;
340
+ vertical-align: top;
341
+ text-align: center;
342
+ justify-content: center;
343
+ overflow: hidden;
344
+ font-size: ${fontSize.mini}px;
345
+ font-weight: ${fontWeight.medium};
346
+ line-height: ${lineHeight.heading};
347
+ text-transform: none;
348
+ text-overflow: ellipsis;
349
+ &:hover {
350
+ text-decoration: none;
351
+ color: inherit;
352
+ }
353
+ `,
354
+ className
355
+ )}
356
+ >
357
+ <FileTitleInner
358
+ title={title}
359
+ containerCss={css`
360
+ max-width: 180px;
361
+ `}
362
+ />
363
+ </div>
321
364
  );
322
365
  }
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const AddDatabase: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"width":20,"height":20,"fill":"none"},"children":[{"type":"element","tagName":"path","properties":{"clipRule":"evenodd","d":"M5.835 8.738c-.35-.17-.66-.37-.92-.603C4.454 7.725 4 7.045 4 6.401 4 4.002 6.686 3 10 3s6 .972 6 3.4c0 .65-.448 1.332-.91 1.746-.262.233-.572.433-.925.603-1.079.52-2.547.751-4.165.751-1.618 0-3.086-.239-4.165-.762ZM2.5 13.599c0 1.904 1.127 3.202 2.58 3.938 1.46.74 3.347.991 5.215.96a.723.723 0 0 0 .705-.73.78.78 0 0 0-.797-.768c-1.94.023-4.927-.181-5.93-2.187a2.783 2.783 0 0 1-.257-1.528c.017-.16.046-.313.088-.46.406.396.89.703 1.405.939 1.498.688 3.213.837 4.844.804a.666.666 0 0 0 .647-.673.715.715 0 0 0-.733-.705c-1.499.024-3.105-.103-4.468-.778a3.92 3.92 0 0 1-.93-.626c-.264-.244-.71-.72-.795-1.083A2.868 2.868 0 0 1 4 10.044c0-.276.036-.535.104-.775.394.384.871.694 1.405.939 1.256.577 2.85.808 4.491.808 1.638 0 3.232-.224 4.49-.797a4.934 4.934 0 0 0 1.41-.94c.034.122.06.25.076.382.025.196.024.392.024.589a.75.75 0 0 0 1.5 0V6.4c0-1.914-1.122-3.215-2.583-3.95-1.385-.697-3.153-.95-4.917-.95-1.77 0-3.538.262-4.92.963C3.626 3.199 2.5 4.497 2.5 6.4v7.198Zm13.25-.849a.75.75 0 0 0-1.5 0v1.5h-1.5a.75.75 0 0 0 0 1.5h1.5v1.5a.75.75 0 1 0 1.5 0v-1.5h1.5a.75.75 0 0 0 0-1.5h-1.5v-1.5Z"},"children":[]}],"metadata":""}]},"name":"add-database"};
6
+ const AddDatabase: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M5.835 8.738c-.35-.17-.66-.37-.92-.603C4.454 7.725 4 7.045 4 6.401 4 4.002 6.686 3 10 3s6 .972 6 3.4c0 .65-.448 1.332-.91 1.746-.262.233-.572.433-.925.603-1.079.52-2.547.751-4.165.751-1.618 0-3.086-.239-4.165-.762ZM2.5 13.599c0 1.904 1.127 3.202 2.58 3.938 1.46.74 3.347.991 5.215.96a.723.723 0 0 0 .705-.73.78.78 0 0 0-.797-.768c-1.94.023-4.927-.181-5.93-2.187a2.783 2.783 0 0 1-.257-1.528c.017-.16.046-.313.088-.46.406.396.89.703 1.405.939 1.498.688 3.213.837 4.844.804a.666.666 0 0 0 .647-.673.715.715 0 0 0-.733-.705c-1.499.024-3.105-.103-4.468-.778a3.92 3.92 0 0 1-.93-.626c-.264-.244-.71-.72-.795-1.083A2.868 2.868 0 0 1 4 10.044c0-.276.036-.535.104-.775.394.384.871.694 1.405.939 1.256.577 2.85.808 4.491.808 1.638 0 3.232-.224 4.49-.797a4.934 4.934 0 0 0 1.41-.94c.034.122.06.25.076.382.025.196.024.392.024.589a.75.75 0 0 0 1.5 0V6.4c0-1.914-1.122-3.215-2.583-3.95-1.385-.697-3.153-.95-4.917-.95-1.77 0-3.538.262-4.92.963C3.626 3.199 2.5 4.497 2.5 6.4v7.198Zm13.25-.849a.75.75 0 0 0-1.5 0v1.5h-1.5a.75.75 0 0 0 0 1.5h1.5v1.5a.75.75 0 1 0 1.5 0v-1.5h1.5a.75.75 0 0 0 0-1.5h-1.5v-1.5Z"},"children":[]}],"metadata":""}]},"name":"add-database"};
7
7
 
8
8
  export default AddDatabase;
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const AddIntegration: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"width":20,"height":20,"fill":"none"},"children":[{"type":"element","tagName":"path","properties":{"clipRule":"evenodd","d":"m8.435 6.627-.7-.7a.803.803 0 0 1 0-1.136l.634-.634a5.283 5.283 0 0 1 6.861-.523l1.376-1.375a.804.804 0 1 1 1.135 1.135L16.366 4.77c1.022 1.394 1.296 3.324.709 4.983-.148.419-.674.592-1.075.348-.358-.218-.48-.672-.375-1.077.375-1.45.044-2.77-.918-3.731a3.655 3.655 0 0 0-5.203 0l-.066.066L13.076 9A.81.81 0 0 1 12 10.21L9.57 7.761l-.699.7a.803.803 0 1 1-1.135-1.136l.699-.7Zm1.272 10.451a5.305 5.305 0 0 1-4.952-.698l-1.377 1.378a.805.805 0 0 1-1.318-.256.803.803 0 0 1 .182-.88l1.378-1.377a5.283 5.283 0 0 1 .523-6.862l.634-.634a.803.803 0 0 1 1.135 0l4.182 4.17A.804.804 0 0 1 9 13.095L5.344 9.452l-.066.067a3.658 3.658 0 0 0 0 5.203c.922.922 2.407 1.14 3.667.84.486-.114 1.029.111 1.18.587.12.377-.046.793-.418.93Zm6.043-4.328a.75.75 0 0 0-1.5 0v1.5h-1.5a.75.75 0 0 0 0 1.5h1.5v1.5a.75.75 0 1 0 1.5 0v-1.5h1.5a.75.75 0 0 0 0-1.5h-1.5v-1.5Z"},"children":[]}],"metadata":""}]},"name":"add-integration"};
6
+ const AddIntegration: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"m8.435 6.627-.7-.7a.803.803 0 0 1 0-1.136l.634-.634a5.283 5.283 0 0 1 6.861-.523l1.376-1.375a.804.804 0 1 1 1.135 1.135L16.366 4.77c1.022 1.394 1.296 3.324.709 4.983-.148.419-.674.592-1.075.348-.358-.218-.48-.672-.375-1.077.375-1.45.044-2.77-.918-3.731a3.655 3.655 0 0 0-5.203 0l-.066.066L13.076 9A.81.81 0 0 1 12 10.21L9.57 7.761l-.699.7a.803.803 0 1 1-1.135-1.136l.699-.7Zm1.272 10.451a5.305 5.305 0 0 1-4.952-.698l-1.377 1.378a.805.805 0 0 1-1.318-.256.803.803 0 0 1 .182-.88l1.378-1.377a5.283 5.283 0 0 1 .523-6.862l.634-.634a.803.803 0 0 1 1.135 0l4.182 4.17A.804.804 0 0 1 9 13.095L5.344 9.452l-.066.067a3.658 3.658 0 0 0 0 5.203c.922.922 2.407 1.14 3.667.84.486-.114 1.029.111 1.18.587.12.377-.046.793-.418.93Zm6.043-4.328a.75.75 0 0 0-1.5 0v1.5h-1.5a.75.75 0 0 0 0 1.5h1.5v1.5a.75.75 0 1 0 1.5 0v-1.5h1.5a.75.75 0 0 0 0-1.5h-1.5v-1.5Z"},"children":[]}],"metadata":""}]},"name":"add-integration"};
7
7
 
8
8
  export default AddIntegration;
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const ArrowsRightLeft: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20","fill":"none"},"children":[{"type":"element","tagName":"path","properties":{"clipRule":"evenodd","d":"M3.223 13.386a.75.75 0 0 0 0 1.061l2.833 2.833a.75.75 0 0 0 1.061-1.06l-1.553-1.553H16.25a.75.75 0 0 0 0-1.5H5.564l1.553-1.553a.75.75 0 0 0-1.06-1.061l-2.834 2.833ZM3 6.083c0 .415.336.75.75.75h10.686l-1.553 1.553a.75.75 0 1 0 1.06 1.061l2.834-2.833a.75.75 0 0 0 0-1.061L13.944 2.72a.75.75 0 0 0-1.061 1.06l1.553 1.553H3.75a.75.75 0 0 0-.75.75Z"},"children":[]}],"metadata":""}]},"name":"arrows-right-left"};
6
+ const ArrowsRightLeft: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M3.223 13.386a.75.75 0 0 0 0 1.061l2.833 2.833a.75.75 0 0 0 1.061-1.06l-1.553-1.553H16.25a.75.75 0 0 0 0-1.5H5.564l1.553-1.553a.75.75 0 0 0-1.06-1.061l-2.834 2.833ZM3 6.083c0 .415.336.75.75.75h10.686l-1.553 1.553a.75.75 0 1 0 1.06 1.061l2.834-2.833a.75.75 0 0 0 0-1.061L13.944 2.72a.75.75 0 0 0-1.061 1.06l1.553 1.553H3.75a.75.75 0 0 0-.75.75Z"},"children":[]}],"metadata":""}]},"name":"arrows-right-left"};
7
7
 
8
8
  export default ArrowsRightLeft;