@fibery/ui-kit 4.0.0 → 4.2.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 (86) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/esfint.config.mjs +0 -17
  3. package/package.json +7 -10
  4. package/scripts/generate-icons.mjs +45 -44
  5. package/src/actions-menu/actions-menu-item.tsx +1 -1
  6. package/src/actions-menu/context-actions-menu.tsx +1 -1
  7. package/src/animated-height-container.tsx +1 -1
  8. package/src/antd/ant-modal.tsx +21 -21
  9. package/src/antd/ant-upload.tsx +13 -13
  10. package/src/antd/auto-complete.tsx +10 -10
  11. package/src/antd/input-number.tsx +55 -45
  12. package/src/antd/styles.ts +30 -22
  13. package/src/antd/tabs.tsx +28 -28
  14. package/src/app-icon-with-fallback.tsx +3 -7
  15. package/src/app-icon-wrapper.tsx +1 -13
  16. package/src/breadcrumb.tsx +5 -1
  17. package/src/color-filter.ts +1 -1
  18. package/src/color-utils.test.ts +2 -2
  19. package/src/color-utils.ts +2 -2
  20. package/src/comment.tsx +2 -2
  21. package/src/copy-to-clipboard.ts +14 -3
  22. package/src/count-badge.tsx +3 -11
  23. package/src/date-picker/contexts.ts +6 -3
  24. package/src/date-picker/date-range-picker.tsx +1 -2
  25. package/src/date-picker/single-date-picker.tsx +1 -2
  26. package/src/day-select/iso-week-day-select.tsx +2 -2
  27. package/src/design-system/colors.ts +60 -40
  28. package/src/design-system/def.ts +1 -1
  29. package/src/dom-utils.ts +5 -12
  30. package/src/download-file.ts +36 -0
  31. package/src/dropdown-menu/index.tsx +0 -1
  32. package/src/emoji-picker/icon-emoji-picker.tsx +3 -3
  33. package/src/file-item/file-menu-items.tsx +29 -11
  34. package/src/file-item/file-preview-actions.tsx +52 -11
  35. package/src/file-item/share-file.ts +53 -0
  36. package/src/file-item.tsx +9 -9
  37. package/src/html-styles.ts +0 -1
  38. package/src/icons/ast/gauge.ts +12 -0
  39. package/src/icons/ast/index.tsx +449 -447
  40. package/src/icons/ast/people-edit.ts +12 -0
  41. package/src/icons/icon.tsx +14 -2
  42. package/src/icons/icons-integrity.test.ts +145 -0
  43. package/src/icons/react/gauge.tsx +18 -0
  44. package/src/icons/react/index.tsx +449 -447
  45. package/src/icons/react/people-edit.tsx +18 -0
  46. package/src/icons/svg/gauge.svg +5 -0
  47. package/src/icons/svg/people-edit.svg +4 -0
  48. package/src/images-gallery/images-gallery.tsx +2 -3
  49. package/src/images-gallery/slide-buttons.tsx +51 -20
  50. package/src/is-in-popup.ts +0 -3
  51. package/src/lists/actions-menu-row-surface.tsx +1 -1
  52. package/src/loading-sausage.tsx +3 -3
  53. package/src/media-query-utils.ts +1 -1
  54. package/src/mobile-keyboard-aware-popup.tsx +1 -1
  55. package/src/number-input/decimal.ts +6 -9
  56. package/src/number-input/number-input-inline-with-autosize.tsx +1 -1
  57. package/src/online-users.tsx +4 -5
  58. package/src/palettes/diff-colors.test.ts +1 -1
  59. package/src/palettes/inspect.defs.colors.neutral-arch.test.ts +98 -30
  60. package/src/palettes/inspect.defs.colors.neutral-user.test.ts +98 -30
  61. package/src/palettes/inspect.defs.colors.warm-arch.test.ts +98 -30
  62. package/src/palettes/inspect.defs.colors.warm-user.test.ts +98 -30
  63. package/src/palettes/show-colors.test.ts +2 -1
  64. package/src/palettes/testkit.ts +3 -1
  65. package/src/popover/index.tsx +24 -15
  66. package/src/popover/mobile-popover-context.tsx +1 -1
  67. package/src/popover/modifiers.tsx +1 -1
  68. package/src/popover/popup-modifiers-context.ts +1 -2
  69. package/src/rich-input-loader.tsx +1 -1
  70. package/src/select/components/menu-list-virtua.tsx +15 -16
  71. package/src/select/components/menu-list-virtualized.tsx +26 -29
  72. package/src/select/components/menu.tsx +3 -3
  73. package/src/select/components/option.tsx +0 -1
  74. package/src/select/index.tsx +2 -1
  75. package/src/select/reflection.ts +4 -5
  76. package/src/select/select-in-popover.tsx +1 -3
  77. package/src/select/select.tsx +5 -3
  78. package/src/select/styles.ts +1 -7
  79. package/src/select/util.ts +2 -2
  80. package/src/thematic.tsx +0 -1
  81. package/src/theme-provider.test.tsx +1 -1
  82. package/src/theming.generated.css +118 -58
  83. package/src/theming.generated.ts +135 -58
  84. package/src/type-badge.tsx +1 -2
  85. package/src/use-on-screen-keyboard-data.tsx +1 -1
  86. package/src/with-data.tsx +1 -1
@@ -1,6 +1,4 @@
1
- import compact from "lodash/compact";
2
- import isFunction from "lodash/isFunction";
3
- import isObject from "lodash/isObject";
1
+ import {isRecord, truthy} from "@fibery/helpers/src/_";
4
2
  import type {ComponentType, CSSProperties, ReactNode} from "react";
5
3
  import {Children, useContext, useEffect, useMemo, useRef, useState} from "react";
6
4
  import type {GroupHeadingProps, GroupProps, MenuListProps} from "react-select";
@@ -20,12 +18,12 @@ function isGroupChild<Option, isMulty extends boolean, Group extends GroupBase<O
20
18
  props: unknown
21
19
  ): props is GroupProps<Option, isMulty, Group> {
22
20
  return (
23
- isObject(props) &&
21
+ isRecord(props) &&
24
22
  "options" in props &&
25
23
  "Heading" in props &&
26
- isFunction(props.Heading) &&
24
+ typeof props.Heading === "function" &&
27
25
  "headingProps" in props &&
28
- isObject(props.headingProps)
26
+ isRecord(props.headingProps)
29
27
  );
30
28
  }
31
29
 
@@ -33,27 +31,26 @@ const flattenGroupChildren: (
33
31
  children: ReactNode,
34
32
  renderGroup: (Component: ComponentType<GroupHeadingProps>, props: GroupProps["headingProps"]) => ReactNode
35
33
  ) => ReactNode[] = (children, renderGroup) => {
36
- return compact(
37
- Children.toArray(children)
38
- .map((child) => {
39
- if (isObject(child) && "props" in child && isObject(child.props)) {
40
- const {props} = child;
41
- if (isGroupChild(props)) {
42
- //well, it's a group
43
- const children = compact(Children.toArray(props.children));
44
- if (!children.length) {
45
- // do not render empty groups
46
- return [];
47
- }
48
- const heading = renderGroup(props.Heading, props.headingProps);
49
- return [heading, ...children];
34
+ return Children.toArray(children)
35
+ .map((child) => {
36
+ if (isRecord(child) && "props" in child && isRecord(child.props)) {
37
+ const {props} = child;
38
+ if (isGroupChild(props)) {
39
+ //well, it's a group
40
+ const children = Children.toArray(props.children).filter(truthy);
41
+ if (!children.length) {
42
+ // do not render empty groups
43
+ return [];
50
44
  }
45
+ const heading = renderGroup(props.Heading, props.headingProps);
46
+ return [heading, ...children];
51
47
  }
52
- //if not a group, just keep child as is
53
- return child;
54
- })
55
- .flat()
56
- );
48
+ }
49
+ //if not a group, just keep child as is
50
+ return child;
51
+ })
52
+ .flat()
53
+ .filter(truthy);
57
54
  };
58
55
 
59
56
  const drawListElement: ItemContent<ReactNode, never> = (index, child) => child;
@@ -111,7 +108,7 @@ export function MenuListVirtualized<
111
108
  return -1;
112
109
  }
113
110
  return flattenChildren.findIndex((child) => {
114
- if (isObject(child) && "props" in child && isObject(child.props) && "data" in child.props) {
111
+ if (isRecord(child) && "props" in child && isRecord(child.props) && "data" in child.props) {
115
112
  return child.props.data === focusedOption;
116
113
  }
117
114
  return false;
@@ -128,14 +125,14 @@ export function MenuListVirtualized<
128
125
  for (let i = 0; i < flattenChildren.length; i++) {
129
126
  const child = flattenChildren[i];
130
127
  if (
131
- isObject(child) &&
128
+ isRecord(child) &&
132
129
  "props" in child &&
133
- isObject(child.props) &&
130
+ isRecord(child.props) &&
134
131
  "type" in child.props &&
135
132
  child.props.type === "option" &&
136
133
  "isSelected" in child.props
137
134
  ) {
138
- if ("data" in child.props && isObject(child.props.data)) {
135
+ if ("data" in child.props && isRecord(child.props.data)) {
139
136
  if ("isSelected" in child.props && child.props.isSelected) {
140
137
  selectedOption = child.props.data;
141
138
  break;
@@ -13,12 +13,12 @@ export const MenuListNulledStyles: CSSObjectWithLabel = {
13
13
  };
14
14
  export const MenuNulledStyles: CSSObjectWithLabel = {
15
15
  backgroundColor: "",
16
- borderRadius: "",
17
16
  boxShadow: "",
18
17
  marginTop: 0,
19
18
  marginBottom: 0,
20
- paddingTop: space.s8,
21
- paddingBottom: space.s8,
19
+ paddingTop: space.s6,
20
+ paddingBottom: space.s6,
21
+ borderRadius: border.radius8,
22
22
  };
23
23
 
24
24
  const menuCss = css`
@@ -99,7 +99,6 @@ export function Option<Option, IsMulti extends boolean = false, Group extends Gr
99
99
  * This makes this option component fast.
100
100
  * Excluding onMouseOver, onMouseMove makes ReactSelect not rerender the whole list on option hover
101
101
  */
102
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
103
102
  const {onMouseOver, onMouseMove, ...truncatedInnerProps} = rest.innerProps;
104
103
  const props = Object.assign(rest, {innerProps: truncatedInnerProps});
105
104
  return <OptionSlow {...props}>{children}</OptionSlow>;
@@ -1,5 +1,5 @@
1
1
  import {css, cx} from "@linaria/core";
2
- import type {ForwardedRef} from "react";
2
+ import {type ForwardedRef} from "react";
3
3
  import React, {forwardRef} from "react";
4
4
 
5
5
  import type {$TSFixMe} from "../tsfixme";
@@ -17,6 +17,7 @@ export type {
17
17
  ControlProps,
18
18
  MultiValue,
19
19
  MultiValueProps,
20
+ MultiValueRemoveProps,
20
21
  OnChangeValue,
21
22
  OptionProps,
22
23
  OptionsOrGroups,
@@ -1,5 +1,4 @@
1
- import isFunction from "lodash/isFunction";
2
- import isObject from "lodash/isObject";
1
+ import {isRecord} from "@fibery/helpers/src/_";
3
2
  import type {GroupProps} from "react-select/dist/declarations/src";
4
3
 
5
4
  import type {GroupBase} from "./util";
@@ -7,7 +6,7 @@ import type {GroupBase} from "./util";
7
6
  type ReactElementWithProps<P = object> = {props: P};
8
7
 
9
8
  export function isReactElementWithProps(node: unknown): node is ReactElementWithProps {
10
- return isObject(node) && "props" in node && isObject(node.props);
9
+ return isRecord(node) && "props" in node && isRecord(node.props);
11
10
  }
12
11
 
13
12
  export function isGroupChild<Option, IsMulti extends boolean, Group extends GroupBase<Option> = GroupBase<Option>>(
@@ -16,8 +15,8 @@ export function isGroupChild<Option, IsMulti extends boolean, Group extends Grou
16
15
  return (
17
16
  "options" in node.props &&
18
17
  "Heading" in node.props &&
19
- isFunction(node.props.Heading) &&
18
+ typeof node.props.Heading === "function" &&
20
19
  "headingProps" in node.props &&
21
- isObject(node.props.headingProps)
20
+ isRecord(node.props.headingProps)
22
21
  );
23
22
  }
@@ -71,7 +71,6 @@ type Props<T, U extends boolean, V extends GroupBase<T>> = {
71
71
  selectStyles?: StylesConfig<T, U, V>;
72
72
  onMenuOpen?: () => void;
73
73
  onMenuClose?: () => void | boolean;
74
- getPopupContainer?: () => HTMLElement;
75
74
  onSelectKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
76
75
  otherSelectProps?: Record<string, unknown>;
77
76
  popoverPlacement?: Placement;
@@ -117,7 +116,6 @@ function SelectInPopoverInner<T, U extends boolean, V extends GroupBase<T>>(
117
116
  onChange,
118
117
  onMenuOpen,
119
118
  onMenuClose,
120
- getPopupContainer,
121
119
  onSelectKeyDown,
122
120
  otherSelectProps,
123
121
  popoverPlacement = "bottom-start",
@@ -199,7 +197,7 @@ function SelectInPopoverInner<T, U extends boolean, V extends GroupBase<T>>(
199
197
  <Popover.Trigger ref={setTriggerElement} asChild triggerEvent="click">
200
198
  {trigger}
201
199
  </Popover.Trigger>
202
- <Wrap with={Popover.Portal} if={renderInPortal} getPopupContainer={getPopupContainer}>
200
+ <Wrap with={Popover.Portal} if={renderInPortal}>
203
201
  <Popover.Content
204
202
  supportMobile
205
203
  title={title}
@@ -1,6 +1,6 @@
1
+ import {truthy} from "@fibery/helpers/src/_";
1
2
  import {composeEventHandlers} from "@fibery/react/src/compose-event-handlers";
2
3
  import {useComposedRefs} from "@fibery/react/src/use-composed-refs";
3
- import compact from "lodash/compact";
4
4
  import type {ForwardedRef, RefObject} from "react";
5
5
  import {forwardRef, useCallback, useMemo, useRef, useState} from "react";
6
6
  import type {
@@ -10,6 +10,7 @@ import type {
10
10
  MenuProps,
11
11
  MultiValue,
12
12
  MultiValueProps,
13
+ MultiValueRemoveProps,
13
14
  OnChangeValue,
14
15
  OptionProps,
15
16
  OptionsOrGroups,
@@ -44,6 +45,7 @@ export type {
44
45
  ControlProps,
45
46
  MultiValue,
46
47
  MultiValueProps,
48
+ MultiValueRemoveProps,
47
49
  OnChangeValue,
48
50
  OptionProps,
49
51
  OptionsOrGroups,
@@ -128,12 +130,12 @@ function useSelectStyles<T, U extends boolean, V extends GroupBase<T>>({
128
130
  }) {
129
131
  return useMemo(() => {
130
132
  return composeStyles<T, U, V>(
131
- compact([
133
+ [
132
134
  makeComponentsStyles<T, U, V>(),
133
135
  virtualized ? makeVirtualizedStyles<T, U, V>() : makeNonVirtualizedStyles<T, U, V>(),
134
136
  zIndex ? makeZIndexStyles<T, U, V>(zIndex) : null,
135
137
  styles,
136
- ])
138
+ ].filter(truthy)
137
139
  );
138
140
  }, [styles, virtualized, zIndex]);
139
141
  }
@@ -53,13 +53,7 @@ export const makeVirtualizedStyles = <T, U extends boolean, V extends GroupBase<
53
53
  }),
54
54
  });
55
55
 
56
- export const makeNonVirtualizedStyles = <T, U extends boolean, V extends GroupBase<T>>(): StylesConfig<T, U, V> => ({
57
- menuList: (provided) => ({
58
- ...provided,
59
- paddingTop: 6,
60
- paddingBottom: 6,
61
- }),
62
- });
56
+ export const makeNonVirtualizedStyles = <T, U extends boolean, V extends GroupBase<T>>(): StylesConfig<T, U, V> => ({});
63
57
 
64
58
  export const makeZIndexStyles = <T, U extends boolean, V extends GroupBase<T>>(
65
59
  zIndex: number
@@ -1,4 +1,4 @@
1
- import isObject from "lodash/isObject";
1
+ import {isRecord} from "@fibery/helpers/src/_";
2
2
  import type {ReactNode, RefObject} from "react";
3
3
  import {Children, createContext} from "react";
4
4
  import type {GroupBase as ReactSelectGroupBase, OptionsOrGroups, SelectInstance} from "react-select";
@@ -11,7 +11,7 @@ export type GroupBase<T> = ReactSelectGroupBase<T> & {separator?: boolean; separ
11
11
  export function isGroup<Option, Group extends GroupBase<Option>>(
12
12
  optionOrGroup: Option | Group
13
13
  ): optionOrGroup is Group {
14
- return isObject(optionOrGroup) && "options" in optionOrGroup;
14
+ return isRecord(optionOrGroup) && "options" in optionOrGroup;
15
15
  }
16
16
 
17
17
  export function countOptions<Option, Group extends GroupBase<Option>>(
package/src/thematic.tsx CHANGED
@@ -1,4 +1,3 @@
1
- // oxlint-disable max-lines
2
1
  import {css} from "@linaria/core";
3
2
  import {useState} from "react";
4
3
  import {createPortal} from "react-dom";
@@ -1,4 +1,4 @@
1
- /* eslint-disable max-lines, no-console */
1
+ /* eslint-disable no-console */
2
2
  import {render, screen} from "@testing-library/react";
3
3
 
4
4
  import {stylesFromTheme, themeFromPalette, themeVars} from "./design-system";