@fibery/ui-kit 3.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/esfint.config.mjs +0 -17
  3. package/package.json +18 -13
  4. package/scripts/generate-icons.mjs +45 -44
  5. package/src/actions-menu/actions-menu-item.tsx +2 -1
  6. package/src/actions-menu/actions-menu.tsx +1 -3
  7. package/src/actions-menu/context-actions-menu.tsx +1 -1
  8. package/src/animated-height-container.tsx +1 -1
  9. package/src/antd/ant-modal.tsx +158 -9
  10. package/src/antd/ant-upload.tsx +285 -27
  11. package/src/antd/auto-complete.tsx +145 -0
  12. package/src/antd/auto-width-transparent-textarea.tsx +9 -2
  13. package/src/antd/global-overrides.ts +352 -0
  14. package/src/antd/index.tsx +3 -2
  15. package/src/antd/input-number.tsx +97 -11
  16. package/src/antd/input.tsx +127 -8
  17. package/src/antd/styles.ts +92 -32
  18. package/src/antd/tabs.tsx +139 -27
  19. package/src/app-icon-with-fallback.tsx +3 -7
  20. package/src/app-icon-wrapper.tsx +1 -13
  21. package/src/avatar.tsx +2 -56
  22. package/src/breadcrumb.tsx +5 -1
  23. package/src/color-adjuster.ts +24 -1
  24. package/src/color-utils.test.ts +2 -2
  25. package/src/color-utils.ts +2 -2
  26. package/src/copy-to-clipboard.ts +14 -3
  27. package/src/count-badge.tsx +10 -1
  28. package/src/date-picker/contexts.ts +6 -3
  29. package/src/date-picker/date-range-picker.tsx +7 -8
  30. package/src/date-picker/single-date-picker.tsx +3 -5
  31. package/src/date-picker/types.ts +1 -1
  32. package/src/date-picker/with-popup-control.tsx +3 -9
  33. package/src/day-select/iso-week-day-select.tsx +2 -2
  34. package/src/design-system/colors-callout.warm-dark.test.ts +22 -22
  35. package/src/design-system/colors-callout.warm-light.test.ts +19 -19
  36. package/src/design-system/colors-css.ts +1 -1
  37. package/src/design-system/colors-enum.dark.warm.test.ts +63 -63
  38. package/src/design-system/colors-enum.light.warm.test.ts +54 -54
  39. package/src/design-system/colors-highlight.warm-dark.test.ts +21 -21
  40. package/src/design-system/colors-highlight.warm-light.test.ts +21 -21
  41. package/src/design-system/colors.ts +4 -4
  42. package/src/design-system/fns.badge.dark.warm.test.ts +34 -34
  43. package/src/design-system/fns.badge.light.warm.test.ts +31 -31
  44. package/src/design-system/fns.deneutralize.test.ts +44 -0
  45. package/src/design-system/fns.icon.dark.warm.test.ts +21 -21
  46. package/src/design-system/fns.icon.light.warm.test.ts +17 -17
  47. package/src/design-system/fns.icon.ts +21 -13
  48. package/src/design-system/fns.ts +27 -3
  49. package/src/design-system/typography.ts +1 -1
  50. package/src/design-system.ts +1 -1
  51. package/src/emoji-picker/icon-emoji-picker.tsx +3 -3
  52. package/src/fibermoji-placeholder.tsx +2 -3
  53. package/src/icons/ast/index.tsx +446 -446
  54. package/src/icons/icon.tsx +23 -1
  55. package/src/icons/icons-integrity.test.ts +145 -0
  56. package/src/icons/react/index.tsx +446 -446
  57. package/src/icons/types.ts +1 -1
  58. package/src/images-gallery/images-gallery.tsx +2 -2
  59. package/src/images-gallery/slide-buttons.tsx +2 -4
  60. package/src/layout-styles.ts +5 -1
  61. package/src/link-input/components/ant-text-area-with-custom-read-state.tsx +2 -1
  62. package/src/lists/actions-menu-row-surface.tsx +1 -1
  63. package/src/media-query-utils.ts +5 -14
  64. package/src/mobile-keyboard-aware-popup.tsx +1 -1
  65. package/src/number-input/decimal.ts +6 -9
  66. package/src/number-input/number-input-inline-with-autosize.tsx +1 -1
  67. package/src/online-users.tsx +4 -5
  68. package/src/palettes/inspect.defs.colors.neutral-arch.test.ts +4 -4
  69. package/src/palettes/inspect.defs.colors.neutral-user.test.ts +4 -4
  70. package/src/palettes/inspect.defs.colors.warm-arch.test.ts +141 -141
  71. package/src/palettes/inspect.defs.colors.warm-user.test.ts +141 -141
  72. package/src/palettes/warm.ts +2 -0
  73. package/src/popover/index.tsx +4 -4
  74. package/src/popover/mobile-popover-context.tsx +1 -1
  75. package/src/popover/modifiers.tsx +1 -1
  76. package/src/rich-input-loader.tsx +1 -1
  77. package/src/root-theme-provider.test.tsx +1 -1
  78. package/src/select/components/menu-list-virtua.tsx +15 -16
  79. package/src/select/components/menu-list-virtualized.tsx +26 -29
  80. package/src/select/components/menu.tsx +3 -3
  81. package/src/select/index.tsx +4 -4
  82. package/src/select/reflection.ts +4 -5
  83. package/src/select/select-in-popover.tsx +34 -51
  84. package/src/select/select.tsx +5 -5
  85. package/src/select/styles.ts +1 -7
  86. package/src/select/util.ts +2 -2
  87. package/src/theme-provider.test.tsx +1 -1
  88. package/src/theme-provider.tsx +3 -9
  89. package/src/theme-snapshots.test.ts +9 -13
  90. package/src/{theming/build.ts → theming.build.ts} +6 -9
  91. package/src/{theming/theming-fibery.snapshot.css → theming.generated.css} +60 -60
  92. package/src/{theming/theming-fibery.snapshot.ts → theming.generated.ts} +60 -60
  93. package/src/type-badge.tsx +1 -2
  94. package/src/{themed-ink.tsx → type-label.tsx} +2 -5
  95. package/src/use-on-screen-keyboard-data.tsx +1 -1
  96. package/src/with-data.tsx +1 -1
  97. package/src/antd/auto-complete.d.ts +0 -2
  98. package/src/antd/auto-complete.ts +0 -37
  99. package/src/antd/tabs.d.ts +0 -5
  100. package/src/theming/index.ts +0 -20
  101. package/src/theming/theming-vzdbery.snapshot.css +0 -2001
  102. package/src/theming/theming-vzdbery.snapshot.ts +0 -2519
@@ -26,7 +26,7 @@ export type IconBaseProps = Omit<SVGProps<SVGSVGElement>, "ref" | "color"> & {
26
26
  iconSize?: number;
27
27
  /** Pass null to inherit parent's color */
28
28
  color?: string | null | undefined;
29
- /** Skip auto-deneutralize when the color is already processed for display (e.g. a11y-adjusted) */
29
+ /** Skip deneutralize&normalize when the color is already processed for display (e.g. a11y-adjusted) */
30
30
  colorProcessed?: boolean;
31
31
  };
32
32
 
@@ -1,8 +1,8 @@
1
- import {createContext} from "@fibery/react/src/create-context";
1
+ import {noop} from "@fibery/helpers/src/_";
2
2
 
3
3
  import "photoswipe/style.css";
4
+ import {createContext} from "@fibery/react/src/create-context";
4
5
  import {css} from "@linaria/core";
5
- import noop from "lodash/noop";
6
6
  /* eslint-disable max-lines */
7
7
  import PhotoSwipeLightbox, {type PhotoSwipeEventsMap, type PhotoSwipeOptions} from "photoswipe/lightbox";
8
8
  import type {PropsWithChildren} from "react";
@@ -245,11 +245,9 @@ function CopyURLButton({pswp, showUI}: {pswp: PhotoSwipe; showUI: () => void}) {
245
245
  if (src) {
246
246
  copyUrlToClipboard({url: src, label: pswp.currSlide.data.label})
247
247
  .then(() => {
248
- toast.success({title: "Copied!"});
248
+ toast.success({title: "Link copied to clipboard"});
249
249
  })
250
- .catch(() => {
251
- toast.error({title: "Unable to copy."});
252
- });
250
+ .catch((error) => toast.error({title: "Unable to copy link to clipboard", subTitle: error.message}));
253
251
  }
254
252
  }}
255
253
  size={isPhone ? "large" : "medium"}
@@ -16,7 +16,7 @@ import {
16
16
  sidebarMenuItemHeightVar,
17
17
  sidebarMenuIconSizeVar,
18
18
  menuItemHeightVar,
19
- } from "./theming";
19
+ } from "./theming.generated";
20
20
 
21
21
  export const layoutStyles = css`
22
22
  :global() {
@@ -40,5 +40,9 @@ export const layoutStyles = css`
40
40
  ${listRowSurfaceFontSizeVar}: ${fontSize.md}px;
41
41
  }
42
42
  }
43
+
44
+ :focus:not(:focus-visible) {
45
+ outline: none;
46
+ }
43
47
  }
44
48
  `;
@@ -2,6 +2,7 @@ import {css} from "@linaria/core";
2
2
  import {useCallback, useRef, useState} from "react";
3
3
 
4
4
  import {AntTextArea} from "../../antd";
5
+ import type {TextAreaRef} from "../../antd/input";
5
6
 
6
7
  const wrapperStyle = css`
7
8
  ${{
@@ -33,7 +34,7 @@ export const AntTextAreaWithCustomReadState = ({
33
34
  ...rest
34
35
  }: AntTextAreaWithCustomReadStateProps) => {
35
36
  const [focus, setFocus] = useState(false);
36
- const input = useRef<HTMLTextAreaElement>(null);
37
+ const input = useRef<TextAreaRef>(null);
37
38
 
38
39
  const handleFocus = useCallback(
39
40
  (e: React.FocusEvent<HTMLTextAreaElement>) => {
@@ -1,7 +1,7 @@
1
+ import {noop} from "@fibery/helpers/src/_";
1
2
  import {stopPropagation} from "@fibery/react/src/stop-propagation";
2
3
  import {useCallbackRef} from "@fibery/react/src/use-callback-ref";
3
4
  import {css, cx} from "@linaria/core";
4
- import noop from "lodash/noop";
5
5
  import {forwardRef, useId} from "react";
6
6
 
7
7
  import {useActionsMenuContext} from "../actions-menu";
@@ -1,4 +1,4 @@
1
- import noop from "lodash/noop";
1
+ import {noop} from "@fibery/helpers/src/_";
2
2
  export function getMediaQueryList(query: string) {
3
3
  // need for test
4
4
  return typeof window !== "undefined" && window.matchMedia
@@ -7,17 +7,8 @@ export function getMediaQueryList(query: string) {
7
7
  }
8
8
 
9
9
  export function subscribeOnChange(mediaQueryList: MediaQueryList, cb: (evt: MediaQueryListEvent) => void): () => void {
10
- // Safari 13 doesn't support addEventListener here
11
- if (mediaQueryList.addEventListener) {
12
- mediaQueryList.addEventListener("change", cb);
13
- return () => {
14
- mediaQueryList.removeEventListener("change", cb);
15
- };
16
- } else if (mediaQueryList.addListener) {
17
- mediaQueryList.addListener(cb);
18
- return () => {
19
- mediaQueryList.removeListener(cb);
20
- };
21
- }
22
- return noop;
10
+ mediaQueryList.addEventListener("change", cb);
11
+ return () => {
12
+ mediaQueryList.removeEventListener("change", cb);
13
+ };
23
14
  }
@@ -1,5 +1,5 @@
1
+ import {noop} from "@fibery/helpers/src/_";
1
2
  import {css, cx} from "@linaria/core";
2
- import noop from "lodash/noop";
3
3
  import type {ReactNode} from "react";
4
4
  import {useEffect, useRef} from "react";
5
5
  import {createPortal} from "react-dom";
@@ -1,12 +1,9 @@
1
- import isNil from "lodash/isNil";
2
- import trimEnd from "lodash/trimEnd";
1
+ import {truthy} from "@fibery/helpers/src/_";
3
2
 
4
3
  type NumericValue = string | number | null | undefined;
5
4
 
6
- const isEmpty = (value: NumericValue): value is null | undefined | "" => isNil(value) || value === "";
7
-
8
5
  const getPrecision = (value: NumericValue) => {
9
- if (isEmpty(value)) {
6
+ if (!truthy(value)) {
10
7
  return 0;
11
8
  }
12
9
  const [, decimalPart = ""] = String(value).split(".");
@@ -14,11 +11,11 @@ const getPrecision = (value: NumericValue) => {
14
11
  };
15
12
 
16
13
  const removeTrailingZeros = (value: string) => {
17
- if (isEmpty(value)) {
14
+ if (!truthy(value)) {
18
15
  return value;
19
16
  }
20
17
  const hasDecimalPart = value.indexOf(".") > 0;
21
- return hasDecimalPart ? trimEnd(trimEnd(value, "0"), ".") : value;
18
+ return hasDecimalPart ? value.replace(/\.?0+$/, "") : value;
22
19
  };
23
20
 
24
21
  export const add = (first: NumericValue, second: NumericValue) => {
@@ -32,7 +29,7 @@ export const sub = (first: NumericValue, second: NumericValue) => {
32
29
  };
33
30
 
34
31
  export const multiplyByHundred = (value: NumericValue) => {
35
- if (isEmpty(value)) {
32
+ if (!truthy(value)) {
36
33
  return value;
37
34
  }
38
35
  const result = Number(value) * 100;
@@ -41,7 +38,7 @@ export const multiplyByHundred = (value: NumericValue) => {
41
38
  };
42
39
 
43
40
  export const divideByHundred = (value: NumericValue) => {
44
- if (isEmpty(value)) {
41
+ if (!truthy(value)) {
45
42
  return value;
46
43
  }
47
44
  const result = Number(value) / 100;
@@ -1,6 +1,6 @@
1
+ import {identity} from "@fibery/helpers/src/_";
1
2
  import {stopPropagation} from "@fibery/react/src/stop-propagation";
2
3
  import {css, cx} from "@linaria/core";
3
- import identity from "lodash/identity";
4
4
  import InputNumber from "rc-input-number";
5
5
  import {useCallback, useMemo, useRef, useState} from "react";
6
6
 
@@ -1,5 +1,4 @@
1
1
  import {css, cx} from "@linaria/core";
2
- import take from "lodash/take";
3
2
  import {useEffect, useRef, useState} from "react";
4
3
 
5
4
  import {AvatarImage} from "./avatar";
@@ -151,8 +150,9 @@ export function OnlineUsers({
151
150
  </Tooltip>
152
151
  </div>
153
152
 
154
- {take(users, users.length === maxVisibleUsers ? maxVisibleUsers : maxVisibleUsers - 1).map(
155
- ({id, avatarUrl, hasAccess, name, callBack, isFollowed}, index) => {
153
+ {users
154
+ .slice(0, users.length === maxVisibleUsers ? maxVisibleUsers : maxVisibleUsers - 1)
155
+ .map(({id, avatarUrl, hasAccess, name, callBack, isFollowed}, index) => {
156
156
  const tooltipDescription = callBack ? "Click to follow" : "";
157
157
  const tooltipTitle = hasAccess ? name : "Private User";
158
158
  const userBorderColor = theme.fns.deneutralize(getObjectColorMemoized(name));
@@ -187,8 +187,7 @@ export function OnlineUsers({
187
187
  </Tooltip>
188
188
  </div>
189
189
  );
190
- }
191
- )}
190
+ })}
192
191
  </div>
193
192
  {Boolean(triggerElement) && users.length > maxVisibleUsers && (
194
193
  <Popover.Root open={visible} onOpen={() => onShow()} onClose={() => onHide()}>
@@ -741,19 +741,19 @@ test("snapshot", () => {
741
741
  "#292929 | hsl(none 0% 16%) | oklch(0.28 0 none)",
742
742
  ],
743
743
  "colorBgListItemGeneralSelected": [
744
- "#FDF3EE | hsl( 20 79% 96%) | oklch(0.97 0.01 49 )",
745
- "#432412 | hsl( 22 58% 17%) | oklch(0.3 0.06 50 )",
744
+ "#F7E0D3 | hsl( 22 69% 90%) | oklch(0.92 0.03 52 )",
745
+ "#4C2A16 | hsl( 22 55% 19%) | oklch(0.32 0.06 50 )",
746
746
  ],
747
747
  "colorBgListItemGeneralSelectedDisabled": [
748
748
  "#F7E0D3 | hsl( 22 69% 90%) | oklch(0.92 0.03 52 )",
749
749
  "#4C2A16 | hsl( 22 55% 19%) | oklch(0.32 0.06 50 )",
750
750
  ],
751
751
  "colorBgListItemGeneralSelectedFocus": [
752
- "#FAEBE3 | hsl( 21 70% 94%) | oklch(0.95 0.02 50 )",
752
+ "#F1D1C0 | hsl( 21 64% 85%) | oklch(0.88 0.04 50 )",
753
753
  "#58321C | hsl( 22 52% 23%) | oklch(0.36 0.06 50 )",
754
754
  ],
755
755
  "colorBgListItemGeneralSelectedHover": [
756
- "#FAEBE3 | hsl( 21 70% 94%) | oklch(0.95 0.02 50 )",
756
+ "#F1D1C0 | hsl( 21 64% 85%) | oklch(0.88 0.04 50 )",
757
757
  "#58321C | hsl( 22 52% 23%) | oklch(0.36 0.06 50 )",
758
758
  ],
759
759
  "colorBgLogoCardDark": [
@@ -741,19 +741,19 @@ test("snapshot", () => {
741
741
  "#292929 | hsl(none 0% 16%) | oklch(0.28 0 none)",
742
742
  ],
743
743
  "colorBgListItemGeneralSelected": [
744
- "#F1F5FE | hsl( 222 87% 97%) | oklch(0.97 0.01 267 )",
745
- "#1C2B4F | hsl( 222 48% 21%) | oklch(0.3 0.07 265 )",
744
+ "#DBE5FA | hsl( 221 76% 92%) | oklch(0.92 0.03 265 )",
745
+ "#223259 | hsl( 223 45% 24%) | oklch(0.32 0.07 266 )",
746
746
  ],
747
747
  "colorBgListItemGeneralSelectedDisabled": [
748
748
  "#DBE5FA | hsl( 221 76% 92%) | oklch(0.92 0.03 265 )",
749
749
  "#223259 | hsl( 223 45% 24%) | oklch(0.32 0.07 266 )",
750
750
  ],
751
751
  "colorBgListItemGeneralSelectedFocus": [
752
- "#E8EFFD | hsl( 220 84% 95%) | oklch(0.95 0.02 264 )",
752
+ "#CAD9F6 | hsl( 220 71% 88%) | oklch(0.88 0.04 264 )",
753
753
  "#293B66 | hsl( 222 43% 28%) | oklch(0.36 0.08 266 )",
754
754
  ],
755
755
  "colorBgListItemGeneralSelectedHover": [
756
- "#E8EFFD | hsl( 220 84% 95%) | oklch(0.95 0.02 264 )",
756
+ "#CAD9F6 | hsl( 220 71% 88%) | oklch(0.88 0.04 264 )",
757
757
  "#293B66 | hsl( 222 43% 28%) | oklch(0.36 0.08 266 )",
758
758
  ],
759
759
  "colorBgLogoCardDark": [