@fibery/ui-kit 1.38.1 → 1.38.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 (38) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +11 -11
  3. package/src/button/button.tsx +1 -2
  4. package/src/card-container.tsx +1 -1
  5. package/src/collapsible/index.tsx +4 -2
  6. package/src/design-system.ts +2 -1
  7. package/src/fibermoji-placeholder.tsx +1 -2
  8. package/src/file-item-2.tsx +188 -30
  9. package/src/file-item.tsx +172 -189
  10. package/src/icons/ast/FileArchive.ts +8 -0
  11. package/src/icons/ast/FileBroken.ts +8 -0
  12. package/src/icons/ast/FileDocument.ts +8 -0
  13. package/src/icons/ast/FileImage.ts +8 -0
  14. package/src/icons/ast/FilePresentation.ts +8 -0
  15. package/src/icons/ast/FileTable.ts +8 -0
  16. package/src/icons/ast/FileVideo.ts +8 -0
  17. package/src/icons/ast/index.tsx +7 -0
  18. package/src/icons/react/FileArchive.tsx +13 -0
  19. package/src/icons/react/FileBroken.tsx +13 -0
  20. package/src/icons/react/FileDocument.tsx +13 -0
  21. package/src/icons/react/FileImage.tsx +13 -0
  22. package/src/icons/react/FilePresentation.tsx +13 -0
  23. package/src/icons/react/FileTable.tsx +13 -0
  24. package/src/icons/react/FileVideo.tsx +13 -0
  25. package/src/icons/react/index.tsx +7 -0
  26. package/src/icons/svg/file-archive.svg +3 -0
  27. package/src/icons/svg/file-broken.svg +3 -0
  28. package/src/icons/svg/file-document.svg +3 -0
  29. package/src/icons/svg/file-image.svg +3 -0
  30. package/src/icons/svg/file-presentation.svg +3 -0
  31. package/src/icons/svg/file-table.svg +3 -0
  32. package/src/icons/svg/file-video.svg +3 -0
  33. package/src/images-gallery-2/images-gallery-2.tsx +105 -25
  34. package/src/images-gallery-2/slide-buttons.tsx +99 -58
  35. package/src/kbd.tsx +1 -1
  36. package/src/loading-sausage.tsx +2 -2
  37. package/src/tooltip.tsx +1 -1
  38. package/src/use-is-phone.tsx +11 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @fibery/ui-kit
2
2
 
3
+ ## 1.38.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 91fc1ea: Bump react to 18.3.1
8
+ - Updated dependencies [91fc1ea]
9
+ - @fibery/react@1.4.6
10
+
3
11
  ## 1.38.1
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/ui-kit",
3
- "version": "1.38.1",
3
+ "version": "1.38.2",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "dependencies": {
@@ -37,23 +37,23 @@
37
37
  "rc-input-number": "8.5.0",
38
38
  "rc-progress": "3.4.1",
39
39
  "react-color": "2.19.3",
40
- "react-day-picker": "8.1.4",
40
+ "react-day-picker": "8.10.1",
41
41
  "react-intersection-observer": "9.3.5",
42
42
  "react-medium-image-zoom": "5.2.10",
43
43
  "react-popper": "2.3.0",
44
44
  "react-select": "5.3.2",
45
45
  "react-select-country-list": "2.2.1",
46
- "react-virtuoso": "4.6.0",
47
- "screenfull": "6.0.1",
46
+ "react-virtuoso": "4.14.1",
47
+ "screenfull": "6.0.2",
48
48
  "tabbable": "5.2.1",
49
49
  "ua-parser-js": "1.0.39",
50
50
  "@fibery/emoji-data": "2.7.1",
51
51
  "@fibery/helpers": "1.3.4",
52
- "@fibery/react": "1.4.5"
52
+ "@fibery/react": "1.4.6"
53
53
  },
54
54
  "peerDependencies": {
55
- "react": "18.2.0",
56
- "react-dom": "18.2.0"
55
+ "react": "18.3.1",
56
+ "react-dom": "18.3.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/core": "7.28.5",
@@ -69,16 +69,16 @@
69
69
  "@types/jest": "30.0.0",
70
70
  "@types/lodash": "4.14.172",
71
71
  "@types/prop-types": "15.7.5",
72
- "@types/react": "18.0.26",
73
- "@types/react-dom": "18.0.10",
72
+ "@types/react": "18.3.12",
73
+ "@types/react-dom": "18.3.1",
74
74
  "@wyw-in-js/babel-preset": "0.5.5",
75
75
  "csstype": "3.0.8",
76
76
  "fs-extra": "10.0.0",
77
77
  "glob": "7.1.7",
78
78
  "jest": "30.2.0",
79
79
  "jest-junit": "16.0.0",
80
- "react": "18.2.0",
81
- "react-dom": "18.2.0",
80
+ "react": "18.3.1",
81
+ "react-dom": "18.3.1",
82
82
  "svg-parser": "2.0.4",
83
83
  "svgo": "2.8.0",
84
84
  "typescript": "5.9.3",
@@ -145,9 +145,8 @@ const buttonSize = {
145
145
  }
146
146
  `,
147
147
  xLarge: css`
148
- font-size: ${textStyles.heading3.fontSize}px;
148
+ font-size: ${textStyles.heading4.fontSize}px;
149
149
  line-height: 20px;
150
- letter-spacing: ${textStyles.heading3.letterSpacing};
151
150
 
152
151
  border-radius: ${border.radius6}px;
153
152
  min-height: ${xLargeButtonHeight}px;
@@ -256,7 +256,7 @@ const coverClassName = css`
256
256
  `;
257
257
 
258
258
  const coverWithContentClassName = css`
259
- border-bottom: ${themeVars.shortcutBorderColor};
259
+ border-bottom: ${themeVars.shortcutBorder};
260
260
  margin-bottom: 0;
261
261
  `;
262
262
 
@@ -1,6 +1,8 @@
1
1
  import {styled} from "@linaria/react";
2
2
  import * as Collapsible from "@radix-ui/react-collapsible";
3
3
 
4
+ export type CollapsibleRootProps = Collapsible.CollapsibleProps;
5
+
4
6
  export const CollapsibleRoot = Collapsible.Root;
5
7
 
6
8
  export const CollapsibleTrigger = Collapsible.Trigger;
@@ -34,10 +36,10 @@ export const CollapsibleContent = styled(Collapsible.Content)`
34
36
 
35
37
  @media (prefers-reduced-motion: no-preference) {
36
38
  &[data-state="open"] {
37
- animation: slideDown 200ms ease-out;
39
+ animation: slideDown 150ms ease-out;
38
40
  }
39
41
  &[data-state="closed"] {
40
- animation: slideUp 200ms ease-out;
42
+ animation: slideUp 150ms ease-out;
41
43
  }
42
44
  }
43
45
  `;
@@ -299,10 +299,11 @@ export const themeColors = {
299
299
  ],
300
300
  entityNodeBgColor: [slate.slate2, slateDark.slate3],
301
301
  shortcutTextColor: [slate.slate9, slateDark.slate11],
302
- shortcutBorderColor: [
302
+ shortcutBorder: [
303
303
  `1px solid ${getOpacities(slate.slate8).opacity50}`,
304
304
  `1px solid ${getOpacities(slateDark.slate10).opacity20}`,
305
305
  ],
306
+ shortcutBorderColor: [getOpacities(slate.slate8).opacity50, getOpacities(slateDark.slate10).opacity20],
306
307
 
307
308
  // Input
308
309
  inputBgColor: [whiteA.whiteA0, slateDark.slate2],
@@ -38,7 +38,7 @@ const mouths = [
38
38
  `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="16" viewBox="0 0 32 16" fill="none"><g clip-path="url(#clip0_31_1134)"><path d="M4.23177 12.4853C2.41601 11.1761 1.06315 9.59547 0.249133 7.87572C-0.702621 5.86498 1.22002 4 3.51791 4L7 4C7.55229 4 8 4.44772 8 5V13.0522C8 13.7579 7.28869 14.2398 6.6548 13.9296C5.79179 13.5074 4.97984 13.0247 4.23177 12.4853Z" fill="currentColor"/><path d="M31.7509 7.87572C30.9369 9.59547 29.584 11.1761 27.7682 12.4853C27.0202 13.0247 26.2082 13.5074 25.3452 13.9296C24.7113 14.2398 24 13.7579 24 13.0522L24 5C24 4.44772 24.4477 4 25 4L28.4821 4C30.78 4 32.7026 5.86498 31.7509 7.87572Z" fill="currentColor"/><path d="M16 16C14.564 16 13.1472 15.8662 11.7816 15.6082C11.3227 15.5215 11 15.1143 11 14.6473V5C11 4.44772 11.4477 4 12 4L20 4C20.5523 4 21 4.44772 21 5V14.6473C21 15.1143 20.6773 15.5215 20.2184 15.6082C18.8528 15.8662 17.436 16 16 16Z" fill="currentColor"/></g><defs><clipPath id="clip0_31_1134"><rect width="32" height="16" fill="white"/></clipPath></defs></svg>`,
39
39
  ];
40
40
 
41
- const getColors = _.memoize((v: string) => {
41
+ export const getColors = _.memoize((v: string) => {
42
42
  const idx = Math.floor((cyrb53(v) / Math.pow(2, 53)) * colors.length);
43
43
  return colors[idx];
44
44
  });
@@ -58,7 +58,6 @@ interface FibermojiPlaceholderProps {
58
58
 
59
59
  export const FibermojiPlaceholder: FC<FibermojiPlaceholderProps> = ({size, radius = "50%", title}) => {
60
60
  const eyes = useRef<HTMLDivElement>(null);
61
-
62
61
  const [fg, bg] = getColors(title ?? "unknown");
63
62
  const mouth = getMouth(title ?? "unknown");
64
63
  const letters = abbreviateName(title).split("");
@@ -1,11 +1,18 @@
1
+ /* eslint-disable max-lines */
1
2
  import {css, cx} from "@linaria/core";
2
3
  import {useCallback, useEffect, useState} from "react";
3
4
  import {ActionsMenu, ActionsMenuItem, ActionsMenuSeparator} from "./actions-menu";
4
5
  import {ActionsButtonCompact} from "./button/actions-button-compact";
5
- import {border, colors, space, themeVars} from "./design-system";
6
+ import {border, colors, space, themeVars, fontSize, fontWeight, lineHeight} from "./design-system";
6
7
  import {makeButtonColors} from "./button/make-button-colors";
7
8
  import Delete from "./icons/react/Delete";
8
9
  import FileDownload from "./icons/react/FileDownload";
10
+ import FileImage from "./icons/react/FileImage";
11
+ import FileVideo from "./icons/react/FileVideo";
12
+ import FileTable from "./icons/react/FileTable";
13
+ import FileDocument from "./icons/react/FileDocument";
14
+ import FileArchive from "./icons/react/FileArchive";
15
+ import FilePresentation from "./icons/react/FilePresentation";
9
16
  import Link from "./icons/react/Link";
10
17
  import RicheditorOpenLink from "./icons/react/RicheditorOpenLink";
11
18
  import Spinner from "./icons/react/Spinner";
@@ -47,8 +54,8 @@ const imageOverlayStyle = css`
47
54
  border-radius: ${border.radius6}px;
48
55
  &:hover {
49
56
  background-position: 0 0;
50
- color: ${themeVars.inversedTextColor},
51
- },
57
+ color: ${themeVars.inversedTextColor};
58
+ }
52
59
  `;
53
60
 
54
61
  const fileOverlayStyle = css`
@@ -61,6 +68,7 @@ export type FileItemType = {
61
68
  url: string;
62
69
  downloadUrl?: string | null;
63
70
  thumbnailUrl: string | null;
71
+ contentType: string;
64
72
  previewData: null | {
65
73
  type: "image" | "video" | "iframe";
66
74
  previewSrc: string | null;
@@ -76,7 +84,7 @@ export type FileItemProps = {
76
84
  };
77
85
 
78
86
  export function FileItem(props: FileItemProps) {
79
- const {name, url, thumbnailUrl, status, previewData: preview} = props.data;
87
+ const {name, url, thumbnailUrl, status, previewData: preview, contentType} = props.data;
80
88
  const isPending = status === "uploading" || status === "deleting";
81
89
  const isBackgroundReady = Boolean(thumbnailUrl && !isPending);
82
90
  const [isActionsOpened, setIsActionsOpened] = useState(false);
@@ -97,8 +105,9 @@ export function FileItem(props: FileItemProps) {
97
105
  src: preview.originalSrc,
98
106
  zoomed: false,
99
107
  setZoomed,
108
+ actions: <FilePreviewActions url={preview.originalSrc} name={name} />,
100
109
  });
101
- }, [imagesRegistry, preview]);
110
+ }, [imagesRegistry, name, preview]);
102
111
 
103
112
  useEffect(() => {
104
113
  if (!preview) {
@@ -117,9 +126,10 @@ export function FileItem(props: FileItemProps) {
117
126
  src: preview.originalSrc,
118
127
  zoomed,
119
128
  setZoomed,
129
+ actions: <FilePreviewActions url={preview.originalSrc} name={name} />,
120
130
  });
121
131
  }
122
- }, [galleryMethods, zoomed, preview, imagesRegistry]);
132
+ }, [galleryMethods, zoomed, preview, imagesRegistry, name]);
123
133
 
124
134
  const onContainerClick = useCallback(() => {
125
135
  if (preview) {
@@ -141,7 +151,7 @@ export function FileItem(props: FileItemProps) {
141
151
  &:hover .${overlayStyle} {
142
152
  opacity: 1;
143
153
  background-position: 0 0;
144
- color: ${themeVars.inversedTextColor};
154
+ color: ${themeVars.whiteColor};
145
155
  background-color: rgba(0, 0, 0, 0.6);
146
156
  }
147
157
  `,
@@ -151,7 +161,7 @@ export function FileItem(props: FileItemProps) {
151
161
  .${overlayStyle} {
152
162
  opacity: 1;
153
163
  background-position: 0 0;
154
- color: ${themeVars.inversedTextColor};
164
+ color: ${themeVars.whiteColor};
155
165
  background-color: rgba(0, 0, 0, 0.6);
156
166
  }
157
167
  `
@@ -200,7 +210,7 @@ export function FileItem(props: FileItemProps) {
200
210
  `}
201
211
  >
202
212
  <Icon containerSize={40} iconSize={40}>
203
- <AppWiki />
213
+ <FileIcon contentType={contentType} />
204
214
  </Icon>
205
215
  <div
206
216
  className={css`
@@ -279,8 +289,6 @@ export function FileItem(props: FileItemProps) {
279
289
  text-overflow: ellipsis;
280
290
  //overflow: hidden;
281
291
  box-sizing: border-box;
282
-
283
- color: ${themeVars.colorBgSidebar};
284
292
  `}
285
293
  >
286
294
  <FileTitle title={name} />
@@ -354,18 +362,13 @@ function FileTitle({title, className}: {title: string; className?: string}) {
354
362
  padding: ${space.s2}px ${space.s5}px;
355
363
  height: 100%;
356
364
  vertical-align: top;
357
-
358
365
  text-align: center;
359
366
  justify-content: center;
360
-
361
367
  word-break: break-word;
362
368
  overflow: hidden;
363
- /* UI/Heading/H8 (reg-400, up) */
364
- font-family: Inter;
365
- font-size: 10px;
366
- font-style: normal;
367
- font-weight: 500;
368
- line-height: 125%; /* 12.5px */
369
+ font-size: ${fontSize.mini}px;
370
+ font-weight: ${fontWeight.medium};
371
+ line-height: ${lineHeight.narrow};
369
372
  text-transform: none;
370
373
  text-overflow: ellipsis;
371
374
  -webkit-line-clamp: 1;
@@ -384,6 +387,19 @@ function FileTitle({title, className}: {title: string; className?: string}) {
384
387
  );
385
388
  }
386
389
 
390
+ function FilePreviewActions({url, name}: {url: string; name: string}) {
391
+ return (
392
+ <>
393
+ <a href={url} target="_blank" rel="noopener noreferrer">
394
+ <ActionsMenuItem Icon={RicheditorOpenLink}>Open in new tab</ActionsMenuItem>
395
+ </a>
396
+ <a download={name} href={`${url}?attachment`}>
397
+ <ActionsMenuItem Icon={FileDownload}>Download</ActionsMenuItem>
398
+ </a>
399
+ </>
400
+ );
401
+ }
402
+
387
403
  function stratFileDownload(url: string, filename: string) {
388
404
  const a = document.createElement("a");
389
405
  a.href = `${url}?attachment`;
@@ -395,14 +411,156 @@ function stratFileDownload(url: string, filename: string) {
395
411
  document.body.removeChild(a);
396
412
  }
397
413
 
398
- // const long = `long text long text long text long text long text long text long text long text long text long text long
399
- // long text long text long text long text long text long text long text long text long text long text long text long
400
- // text long text long text long text long text long text long text long text long text long text long text long text
401
- // long text long text long text long text long text long text long text long text long text long text long text long
402
- // text long text long text long text long text long text long text long text long text long text long text long text
403
- // long text long text long text long text long text long text long text long text long text long text long text long
404
- // text long text long text long text long text long text long text long text long text long text long text long text
405
- // long text long text long text long text long text long text long text long text long text long text long text long
406
- // text long text long text long text long text long text long text long text long text long text long text long text
407
- // long text long text long text long text long text long text long text
408
- // `;
414
+ function FileIcon({contentType}: {contentType: string}) {
415
+ if (contentType.startsWith("image/")) {
416
+ return <FileImage />;
417
+ }
418
+ if (contentType.startsWith("video/")) {
419
+ return <FileVideo />;
420
+ }
421
+ if (SheetsContentTypes.includes(contentType)) {
422
+ return <FileTable />;
423
+ }
424
+ if (ArchiveContentTypes.includes(contentType)) {
425
+ return <FileArchive />;
426
+ }
427
+ if (PresentationContentTypes.includes(contentType)) {
428
+ return <FilePresentation />;
429
+ }
430
+ if (DocumentContentTypes.includes(contentType) || contentType.startsWith("text/")) {
431
+ return <FileDocument />;
432
+ }
433
+
434
+ return <AppWiki />;
435
+ }
436
+
437
+ const ArchiveContentTypes = [
438
+ "application/zip",
439
+ "application/zip-compressed",
440
+ "application/x-zip",
441
+ "application/x-zip-compressed",
442
+ "multipart/x-zip",
443
+
444
+ "application/x-rar-compressed",
445
+ "application/vnd.rar",
446
+
447
+ "application/x-7z-compressed",
448
+
449
+ "application/gzip",
450
+ "application/x-gzip",
451
+
452
+ "application/x-tar",
453
+
454
+ "application/x-bzip",
455
+ "application/x-bzip2",
456
+ "application/x-bzip3",
457
+ "application/x-bzip4",
458
+
459
+ "application/x-xz",
460
+
461
+ "application/zstd",
462
+ "application/x-zstd",
463
+
464
+ "application/x-lzma",
465
+ "application/x-lzip",
466
+
467
+ "application/x-lzh",
468
+ "application/x-lha",
469
+
470
+ "application/x-iso9660-image",
471
+ "application/x-cd-image",
472
+
473
+ "application/x-apple-diskimage",
474
+
475
+ "application/x-arj",
476
+
477
+ "application/x-cpio",
478
+
479
+ "application/x-rpm",
480
+
481
+ "application/x-deb",
482
+ "application/vnd.debian.binary-package",
483
+
484
+ "application/x-compress",
485
+ "application/x-archive",
486
+ "application/vnd.android.package-archive",
487
+ ];
488
+
489
+ const PresentationContentTypes = [
490
+ "application/x-iwork-keynote-sffkey",
491
+ "application/vnd.ms-powerpoint",
492
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
493
+ "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
494
+ "application/vnd.openxmlformats-officedocument.presentationml.template",
495
+ "application/vnd.ms-powerpoint.presentation.macroEnabled.12",
496
+ "application/vnd.ms-powerpoint.slideshow.macroEnabled.12",
497
+ "application/vnd.ms-powerpoint.template.macroEnabled.12",
498
+ "application/vnd.oasis.opendocument.presentation",
499
+ "application/vnd.oasis.opendocument.presentation-template",
500
+ "application/vnd.apple.keynote",
501
+ "application/vnd.google-apps.presentation",
502
+ "application/pdf",
503
+ "application/vnd.sun.xml.impress",
504
+ "application/vnd.stardivision.impress",
505
+ ];
506
+
507
+ const SheetsContentTypes = [
508
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
509
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
510
+ "application/vnd.ms-excel",
511
+ "application/vnd.ms-excel.sheet.macroEnabled.12",
512
+ "application/vnd.ms-excel.template.macroEnabled.12",
513
+ "application/vnd.ms-excel.addin.macroEnabled.12",
514
+ "application/vnd.ms-excel.sheet.binary.macroEnabled.12",
515
+ "application/vnd.oasis.opendocument.spreadsheet",
516
+ "application/vnd.oasis.opendocument.spreadsheet-template",
517
+ "application/vnd.apple.numbers",
518
+ "application/vnd.google-apps.spreadsheet",
519
+ "text/csv",
520
+ "text/x-comma-separated-values",
521
+ "application/csv",
522
+ "text/tab-separated-values",
523
+ "application/vnd.lotus-1-2-3",
524
+ "application/x-123",
525
+ "application/vnd.stardivision.calc",
526
+ "application/vnd.sun.xml.calc",
527
+ "application/x-dbase",
528
+ "application/x-iwork-numbers-sffnumbers",
529
+ ];
530
+
531
+ const DocumentContentTypes = [
532
+ "application/msword",
533
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
534
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
535
+ "application/vnd.ms-word.document.macroEnabled.12",
536
+ "application/vnd.ms-word.template.macroEnabled.12",
537
+
538
+ "application/vnd.oasis.opendocument.text",
539
+ "application/vnd.oasis.opendocument.text-template",
540
+ "application/vnd.oasis.opendocument.text-master",
541
+ "application/vnd.oasis.opendocument.text-web",
542
+
543
+ "application/vnd.apple.pages",
544
+ "application/x-iwork-pages-sffpages",
545
+
546
+ "application/rtf",
547
+ "text/rtf",
548
+
549
+ "text/plain",
550
+ "text/markdown",
551
+ "text/html",
552
+
553
+ "application/vnd.google-apps.document",
554
+
555
+ "application/vnd.sun.xml.writer",
556
+ "application/vnd.sun.xml.writer.template",
557
+ "application/vnd.sun.xml.writer.global",
558
+
559
+ "application/vnd.stardivision.writer",
560
+ "application/vnd.stardivision.writer-global",
561
+
562
+ "application/x-mswrite",
563
+ "application/x-abiword",
564
+
565
+ "application/pdf",
566
+ ];