@fibery/ui-kit 2.0.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.
- package/.oxlintrc.json +24 -0
- package/CHANGELOG.md +7 -0
- package/eslint.config.mjs +1 -1
- package/jest.config.cjs +36 -0
- package/package.json +10 -50
- package/src/@types/css.d.ts +1 -0
- package/src/actions-menu/actions-menu-checkbox-item.tsx +74 -0
- package/src/actions-menu/contexts/actions-menu-context.tsx +1 -0
- package/src/actions-menu/index.tsx +1 -0
- package/src/animated-number.tsx +2 -2
- package/src/antd/AutoComplete.d.ts +1 -0
- package/src/app-icon-with-fallback.tsx +4 -4
- package/src/app-icon.tsx +4 -4
- package/src/appIcons.json +1227 -1227
- package/src/avatar.tsx +44 -5
- package/src/box.tsx +10 -17
- package/src/button/make-button-colors.ts +13 -13
- package/src/checkbox.tsx +3 -3
- package/src/collapsible-section.tsx +1 -1
- package/src/context-menu/index.tsx +4 -0
- package/src/date-picker/date-range-picker.tsx +1 -1
- package/src/date-picker/relative-date-picker.tsx +3 -0
- package/src/date-picker/single-date-picker.tsx +10 -9
- package/src/design-system/alpha.ts +9 -0
- package/src/design-system/colors-css.test.ts +1 -9
- package/src/design-system/colors-css.ts +1 -1
- package/src/design-system/colors.ts +351 -313
- package/src/design-system/layout.ts +1 -1
- package/src/design-system/theme.ts +4 -1
- package/src/design-system/vars.test.ts +4 -0
- package/src/design-system.test.ts +1 -0
- package/src/design-system.ts +1 -1
- package/src/dropdown-menu/index.tsx +4 -0
- package/src/emoji-picker/primitives/emoji.tsx +12 -0
- package/src/emoji-picker/primitives/grid.tsx +100 -104
- package/src/emoji.tsx +1 -0
- package/src/file-item.tsx +308 -265
- package/src/icons/ast/AddDatabase.ts +1 -1
- package/src/icons/ast/AddIntegration.ts +1 -1
- package/src/icons/ast/ArrowsRightLeft.ts +1 -1
- package/src/icons/ast/ChatBubble.ts +1 -1
- package/src/icons/ast/ChatFloat.ts +1 -1
- package/src/icons/ast/ChatSidebar.ts +1 -1
- package/src/icons/ast/Clean.ts +1 -1
- package/src/icons/ast/Create.ts +1 -1
- package/src/icons/ast/ItemsTimeline.ts +1 -1
- package/src/icons/ast/Key.ts +1 -1
- package/src/icons/ast/NetworkAdd.ts +1 -1
- package/src/icons/ast/Print.ts +1 -1
- package/src/icons/ast/Success.ts +1 -1
- package/src/icons/ast/SuggestIntegration.ts +1 -1
- package/src/icons/ast/WarningTriangle.ts +1 -1
- package/src/icons/ast/Windows.ts +1 -1
- package/src/icons/svg/add-database.svg +1 -1
- package/src/icons/svg/add-integration.svg +1 -1
- package/src/icons/svg/arrows-right-left.svg +1 -1
- package/src/icons/svg/chat-bubble.svg +1 -1
- package/src/icons/svg/chat-float.svg +1 -1
- package/src/icons/svg/chat-sidebar.svg +3 -3
- package/src/icons/svg/clean.svg +1 -1
- package/src/icons/svg/create.svg +1 -1
- package/src/icons/svg/items-timeline.svg +1 -1
- package/src/icons/svg/key.svg +1 -1
- package/src/icons/svg/network-add.svg +1 -1
- package/src/icons/svg/print.svg +1 -1
- package/src/icons/svg/success.svg +1 -1
- package/src/icons/svg/suggest-integration.svg +1 -1
- package/src/icons/svg/warning-triangle.svg +1 -1
- package/src/icons/svg/windows.svg +1 -1
- package/src/images-gallery/images-gallery.tsx +24 -0
- package/src/lists/actions-menu-row-surface.tsx +2 -1
- package/src/logo.tsx +14 -13
- package/src/modal-menu/index.tsx +1 -0
- package/src/modal-menu/modal-menu-checkbox-item.tsx +50 -0
- package/src/online-users.tsx +45 -46
- package/src/palettes/slate-arch.colors-snapshot.test.ts +7 -7
- package/src/palettes/slate-user.colors-snapshot.test.ts +11 -11
- package/src/palettes/warm-arch.colors-snapshot.test.ts +7 -7
- package/src/palettes/warm-user.colors-snapshot.test.ts +7 -7
- package/src/popover/index.tsx +91 -203
- package/src/popover/popover-old.tsx +113 -0
- package/src/popover/popup-modifiers-context.ts +1 -1
- package/src/scale-generator.ts +2 -2
- package/src/select/components/clear-indicator.tsx +1 -1
- package/src/select/components/drop-down-indicator.tsx +2 -2
- package/src/select/components/group-heading.tsx +2 -2
- package/src/select/components/menu-list-virtualized.tsx +1 -1
- package/src/select/components/option.tsx +1 -1
- package/src/select/index.tsx +34 -37
- package/src/select/select-in-popover.tsx +34 -202
- package/src/select/select.tsx +5 -4
- package/src/select/styles.ts +3 -0
- package/src/thematic-state.ts +1 -1
- package/src/theme-provider.tsx +14 -2
- package/src/theme-styles.ts +14 -7
- package/src/toggle-button/toggle-button.tsx +48 -35
- package/src/tree-utils.test.ts +166 -0
- package/src/tree-utils.ts +107 -0
- package/src/file-item/use-register-in-image-gallery.tsx +0 -70
- package/src/file-item-2.tsx +0 -357
package/src/file-item-2.tsx
DELETED
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import {css, cx} from "@linaria/core";
|
|
2
|
-
import {CSSProperties, useState} from "react";
|
|
3
|
-
import {ActionsMenu} from "./actions-menu";
|
|
4
|
-
import {ActionsButtonCompact} from "./button/actions-button-compact";
|
|
5
|
-
import {border, fontSize, fontWeight, lineHeight, space, themeVars} from "./design-system";
|
|
6
|
-
import {makeButtonColors} from "./button/make-button-colors";
|
|
7
|
-
import {useTheme} from "./theme-provider";
|
|
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";
|
|
14
|
-
|
|
15
|
-
const fileItemStyle = css`
|
|
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
|
-
}
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
const thumbnailStyle = css`
|
|
29
|
-
border: 1px solid ${themeVars.separatorColor};
|
|
30
|
-
`;
|
|
31
|
-
|
|
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;
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
const imageOverlayStyle = css`
|
|
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
|
-
}
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
const fileOverlayStyle = css`
|
|
59
|
-
opacity: 1;
|
|
60
|
-
background: transparent;
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
const actionsButtonStyle = css`
|
|
64
|
-
position: absolute;
|
|
65
|
-
top: ${space.s8}px;
|
|
66
|
-
right: ${space.s8}px;
|
|
67
|
-
opacity: 0;
|
|
68
|
-
`;
|
|
69
|
-
|
|
70
|
-
export type FileItemProps = {
|
|
71
|
-
data: UploadFileWithContent;
|
|
72
|
-
onDownloadClick?: () => void;
|
|
73
|
-
onRemoveClick?: () => void;
|
|
74
|
-
onRenameClick?: (file: {id: string; name: string}) => void;
|
|
75
|
-
onClick?: () => void;
|
|
76
|
-
disabled?: boolean;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const minFileTileWidth = 120;
|
|
80
|
-
|
|
81
|
-
export function FileItem(props: FileItemProps) {
|
|
82
|
-
const theme = useTheme();
|
|
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);
|
|
89
|
-
|
|
90
|
-
const showFileIcon = !isPending && !isBackgroundReady;
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<>
|
|
94
|
-
<div
|
|
95
|
-
className={cx(
|
|
96
|
-
css`
|
|
97
|
-
flex: 1 0 0;
|
|
98
|
-
height: 100%;
|
|
99
|
-
min-width: ${minFileTileWidth}px;
|
|
100
|
-
`,
|
|
101
|
-
isBackgroundReady &&
|
|
102
|
-
css`
|
|
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
|
-
}
|
|
138
|
-
`
|
|
139
|
-
)}
|
|
140
|
-
>
|
|
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 className={cx(overlayStyle, fileOverlayStyle)}>
|
|
172
|
-
<div
|
|
173
|
-
className={css`
|
|
174
|
-
display: flex;
|
|
175
|
-
flex-direction: column;
|
|
176
|
-
justify-content: center; /* centers vertically */
|
|
177
|
-
align-items: center; /* centers horizontally */
|
|
178
|
-
height: 100%;
|
|
179
|
-
width: 100%;
|
|
180
|
-
padding-top: ${space.s1}px;
|
|
181
|
-
gap: ${space.s2}px;
|
|
182
|
-
`}
|
|
183
|
-
>
|
|
184
|
-
<Icon containerSize={40} iconSize={40}>
|
|
185
|
-
<FileIcon contentType={contentType} />
|
|
186
|
-
</Icon>
|
|
187
|
-
<div
|
|
188
|
-
className={css`
|
|
189
|
-
display: flex;
|
|
190
|
-
width: 100%;
|
|
191
|
-
justify-content: center;
|
|
192
|
-
gap: 10px;
|
|
193
|
-
flex-shrink: 0;
|
|
194
|
-
color: ${themeVars.colorTextMenuItem};
|
|
195
|
-
text-overflow: ellipsis;
|
|
196
|
-
overflow: hidden;
|
|
197
|
-
`}
|
|
198
|
-
>
|
|
199
|
-
<FileTitle
|
|
200
|
-
title={name}
|
|
201
|
-
className={css`
|
|
202
|
-
overflow: hidden;
|
|
203
|
-
text-overflow: ellipsis;
|
|
204
|
-
`}
|
|
205
|
-
/>
|
|
206
|
-
</div>
|
|
207
|
-
</div>
|
|
208
|
-
<div className={actionsButtonStyle}>
|
|
209
|
-
<FileActionsMenu
|
|
210
|
-
setIsActionsOpened={setIsActionsOpened}
|
|
211
|
-
data={props.data}
|
|
212
|
-
disabled={props.disabled}
|
|
213
|
-
onDownloadClick={onDownloadClick}
|
|
214
|
-
onRemoveClick={onRemoveClick}
|
|
215
|
-
onRenameClick={props.onRenameClick}
|
|
216
|
-
/>
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
)}
|
|
220
|
-
{!isPending && !showFileIcon && (
|
|
221
|
-
<div className={cx(overlayStyle, isBackgroundReady ? imageOverlayStyle : fileOverlayStyle)}>
|
|
222
|
-
<div
|
|
223
|
-
className={css`
|
|
224
|
-
position: relative;
|
|
225
|
-
display: flex;
|
|
226
|
-
flex-direction: column;
|
|
227
|
-
justify-content: space-between; /* Top + bottom placement */
|
|
228
|
-
width: 100%;
|
|
229
|
-
height: 100%;
|
|
230
|
-
overflow: hidden;
|
|
231
|
-
box-sizing: border-box;
|
|
232
|
-
gap: ${space.s8}px;
|
|
233
|
-
`}
|
|
234
|
-
>
|
|
235
|
-
<div
|
|
236
|
-
className={css`
|
|
237
|
-
align-self: flex-end;
|
|
238
|
-
`}
|
|
239
|
-
>
|
|
240
|
-
<FileActionsMenu
|
|
241
|
-
setIsActionsOpened={setIsActionsOpened}
|
|
242
|
-
data={props.data}
|
|
243
|
-
disabled={props.disabled}
|
|
244
|
-
actionsButtonStyle={
|
|
245
|
-
isBackgroundReady ? makeButtonColors(themeVars.inversedTextColor, "ghost", theme) : undefined
|
|
246
|
-
}
|
|
247
|
-
onDownloadClick={onDownloadClick}
|
|
248
|
-
onRemoveClick={props.onRemoveClick}
|
|
249
|
-
onRenameClick={props.onRenameClick}
|
|
250
|
-
/>
|
|
251
|
-
</div>
|
|
252
|
-
<div
|
|
253
|
-
className={css`
|
|
254
|
-
display: flex;
|
|
255
|
-
width: 100%;
|
|
256
|
-
align-self: flex-start;
|
|
257
|
-
align-items: flex-end;
|
|
258
|
-
text-overflow: ellipsis;
|
|
259
|
-
box-sizing: border-box;
|
|
260
|
-
`}
|
|
261
|
-
>
|
|
262
|
-
<FileTitle title={name} />
|
|
263
|
-
</div>
|
|
264
|
-
</div>
|
|
265
|
-
</div>
|
|
266
|
-
)}
|
|
267
|
-
</div>
|
|
268
|
-
{thumbnailUrl ? (
|
|
269
|
-
<img
|
|
270
|
-
style={{display: "none"}}
|
|
271
|
-
onError={() => setIsThumbnailLoadFailed(true)}
|
|
272
|
-
src={thumbnailUrl}
|
|
273
|
-
alt="invisible"
|
|
274
|
-
/>
|
|
275
|
-
) : null}
|
|
276
|
-
</div>
|
|
277
|
-
</>
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function FileActionsMenu({
|
|
282
|
-
data,
|
|
283
|
-
disabled,
|
|
284
|
-
setIsActionsOpened,
|
|
285
|
-
onDownloadClick,
|
|
286
|
-
onRemoveClick,
|
|
287
|
-
onRenameClick,
|
|
288
|
-
actionsButtonStyle,
|
|
289
|
-
}: {
|
|
290
|
-
data: UploadFileWithContent;
|
|
291
|
-
onDownloadClick?: () => void;
|
|
292
|
-
onRemoveClick?: () => void;
|
|
293
|
-
onRenameClick?: (data: {id: string; name: string}) => void;
|
|
294
|
-
disabled?: boolean;
|
|
295
|
-
setIsActionsOpened: (val: boolean) => void;
|
|
296
|
-
actionsButtonStyle?: CSSProperties;
|
|
297
|
-
}) {
|
|
298
|
-
return (
|
|
299
|
-
<ActionsMenu
|
|
300
|
-
onOpenChange={setIsActionsOpened}
|
|
301
|
-
trigger={
|
|
302
|
-
<ActionsButtonCompact
|
|
303
|
-
className={css`
|
|
304
|
-
z-index: 1;
|
|
305
|
-
`}
|
|
306
|
-
style={actionsButtonStyle}
|
|
307
|
-
/>
|
|
308
|
-
}
|
|
309
|
-
>
|
|
310
|
-
{
|
|
311
|
-
<FileMenuItems
|
|
312
|
-
file={data}
|
|
313
|
-
disabled={disabled}
|
|
314
|
-
onDownloadClick={onDownloadClick}
|
|
315
|
-
onRemoveClick={onRemoveClick}
|
|
316
|
-
onRenameClick={onRenameClick}
|
|
317
|
-
/>
|
|
318
|
-
}
|
|
319
|
-
</ActionsMenu>
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function FileTitle({title, className}: {title: string; className?: string}) {
|
|
324
|
-
return (
|
|
325
|
-
<div
|
|
326
|
-
className={cx(
|
|
327
|
-
css`
|
|
328
|
-
border-radius: ${border.radius4}px;
|
|
329
|
-
background: ${themeVars.badgeBgColor};
|
|
330
|
-
padding: ${space.s2}px ${space.s5}px;
|
|
331
|
-
height: 100%;
|
|
332
|
-
vertical-align: top;
|
|
333
|
-
text-align: center;
|
|
334
|
-
justify-content: center;
|
|
335
|
-
overflow: hidden;
|
|
336
|
-
font-size: ${fontSize.mini}px;
|
|
337
|
-
font-weight: ${fontWeight.medium};
|
|
338
|
-
line-height: ${lineHeight.heading};
|
|
339
|
-
text-transform: none;
|
|
340
|
-
text-overflow: ellipsis;
|
|
341
|
-
&:hover {
|
|
342
|
-
text-decoration: none;
|
|
343
|
-
color: inherit;
|
|
344
|
-
}
|
|
345
|
-
`,
|
|
346
|
-
className
|
|
347
|
-
)}
|
|
348
|
-
>
|
|
349
|
-
<FileTitleInner
|
|
350
|
-
title={title}
|
|
351
|
-
containerCss={css`
|
|
352
|
-
max-width: 180px;
|
|
353
|
-
`}
|
|
354
|
-
/>
|
|
355
|
-
</div>
|
|
356
|
-
);
|
|
357
|
-
}
|