@fibery/ui-kit 1.34.8 → 1.35.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.
- package/package.json +4 -4
- package/src/actions-menu/actions-menu-sub-menu.tsx +3 -0
- package/src/antd/styles.ts +6 -6
- package/src/button/base-button.tsx +1 -1
- package/src/button/icon-button.tsx +2 -2
- package/src/design-system.ts +55 -31
- package/src/dropdown-menu/index.tsx +2 -3
- package/src/emoji-picker/app-icon-picker.tsx +1 -0
- package/src/emoji-picker/primitives/emoji.tsx +4 -2
- package/src/emoji-picker/primitives/render-config-provider.tsx +12 -0
- package/src/icons/ast/AddDatabase.ts +8 -0
- package/src/icons/ast/AddIntegration.ts +8 -0
- package/src/icons/ast/AiSearch.ts +8 -0
- package/src/icons/ast/Clean.ts +8 -0
- package/src/icons/ast/CreditsFilled.ts +8 -0
- package/src/icons/ast/Gift.ts +8 -0
- package/src/icons/ast/Markdown.ts +8 -0
- package/src/icons/ast/PeopleCheck.ts +8 -0
- package/src/icons/ast/PresentPlay.ts +8 -0
- package/src/icons/ast/PresentStop.ts +8 -0
- package/src/icons/ast/SettingsOff.ts +8 -0
- package/src/icons/ast/Template.ts +8 -0
- package/src/icons/ast/UserCheck.ts +8 -0
- package/src/icons/ast/UserGroupRemove.ts +8 -0
- package/src/icons/ast/UserX.ts +8 -0
- package/src/icons/ast/Views.ts +1 -1
- package/src/icons/ast/index.tsx +15 -0
- package/src/icons/react/AddDatabase.tsx +13 -0
- package/src/icons/react/AddIntegration.tsx +13 -0
- package/src/icons/react/AiSearch.tsx +13 -0
- package/src/icons/react/Clean.tsx +13 -0
- package/src/icons/react/CreditsFilled.tsx +13 -0
- package/src/icons/react/Gift.tsx +13 -0
- package/src/icons/react/Markdown.tsx +13 -0
- package/src/icons/react/PeopleCheck.tsx +13 -0
- package/src/icons/react/PresentPlay.tsx +13 -0
- package/src/icons/react/PresentStop.tsx +13 -0
- package/src/icons/react/SettingsOff.tsx +13 -0
- package/src/icons/react/Template.tsx +13 -0
- package/src/icons/react/UserCheck.tsx +13 -0
- package/src/icons/react/UserGroupRemove.tsx +13 -0
- package/src/icons/react/UserX.tsx +13 -0
- package/src/icons/react/index.tsx +15 -0
- package/src/palette.ts +2 -30
- package/src/select/custom-select-partials/clear-indicator.tsx +4 -0
- package/src/select/custom-select-partials/group-heading.tsx +4 -5
- package/src/select/custom-select-partials/menu-list-virtualized.tsx +22 -4
- package/src/select/custom-select-partials/menu.tsx +5 -6
- package/src/select/index.tsx +39 -28
- package/src/select/select-in-popover.tsx +18 -16
- package/src/select/styles.ts +10 -2
- package/src/toast/toast-queue.ts +1 -1
- package/src/tooltip.tsx +6 -0
package/src/select/index.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import {useComposedRefs} from "@fibery/react/src/use-composed-refs";
|
|
1
2
|
import {forwardRef, RefObject, useCallback, useMemo, useRef, useState} from "react";
|
|
2
3
|
import BaseSelect, {
|
|
3
4
|
ActionMeta,
|
|
4
|
-
|
|
5
|
+
Props as BaseSelectProps,
|
|
5
6
|
createFilter,
|
|
6
7
|
MenuListProps,
|
|
7
8
|
MenuProps,
|
|
@@ -11,43 +12,47 @@ import BaseSelect, {
|
|
|
11
12
|
OnChangeValue,
|
|
12
13
|
OptionProps,
|
|
13
14
|
OptionsOrGroups,
|
|
14
|
-
Props as BaseSelectProps,
|
|
15
15
|
PropsValue,
|
|
16
|
+
components as reactSelectComponents,
|
|
16
17
|
SelectInstance,
|
|
17
18
|
SingleValue,
|
|
18
19
|
SingleValueProps,
|
|
19
20
|
StylesConfig,
|
|
20
21
|
} from "react-select";
|
|
21
22
|
import BaseCreatableSelect, {CreatableProps} from "react-select/creatable";
|
|
22
|
-
import {
|
|
23
|
-
import {useSelectControlSettings} from "./select-control-settings-context";
|
|
24
|
-
import {Option, OptionSlow} from "./custom-select-partials/option";
|
|
25
|
-
import {Menu} from "./custom-select-partials/menu";
|
|
26
|
-
import {GroupHeading} from "./custom-select-partials/group-heading";
|
|
23
|
+
import {ClearIndicator, NoClearIndicator} from "./custom-select-partials/clear-indicator";
|
|
27
24
|
import {DropdownIndicator} from "./custom-select-partials/drop-down-indicator";
|
|
25
|
+
import {GroupHeading} from "./custom-select-partials/group-heading";
|
|
26
|
+
import {Menu} from "./custom-select-partials/menu";
|
|
27
|
+
import {MenuListVirtualized} from "./custom-select-partials/menu-list-virtualized";
|
|
28
28
|
import {NoOptionsMessage} from "./custom-select-partials/no-option-message";
|
|
29
|
-
import {
|
|
29
|
+
import {Option, OptionSlow} from "./custom-select-partials/option";
|
|
30
|
+
import {useSelectControlSettings} from "./select-control-settings-context";
|
|
31
|
+
import {
|
|
32
|
+
componentsStyles,
|
|
33
|
+
nonVirtualizedStyles,
|
|
34
|
+
singleLineComponentsStyle,
|
|
35
|
+
virtualizedStyles,
|
|
36
|
+
zIndexStyles,
|
|
37
|
+
} from "./styles";
|
|
30
38
|
import {countOptions, GroupBase, ReactSelectRefContext} from "./util";
|
|
31
|
-
import {MenuListVirtualized} from "./custom-select-partials/menu-list-virtualized";
|
|
32
|
-
import {useComposedRefs} from "@fibery/react/src/use-composed-refs";
|
|
33
39
|
|
|
40
|
+
export {reactSelectComponents as components, MenuListVirtualized};
|
|
34
41
|
export type {
|
|
35
|
-
|
|
42
|
+
ActionMeta,
|
|
36
43
|
GroupBase,
|
|
37
|
-
StylesConfig,
|
|
38
|
-
MenuProps,
|
|
39
44
|
MenuListProps,
|
|
40
|
-
|
|
41
|
-
SingleValueProps,
|
|
42
|
-
MultiValueProps,
|
|
43
|
-
SingleValue,
|
|
45
|
+
MenuProps,
|
|
44
46
|
MultiValue,
|
|
45
|
-
|
|
47
|
+
MultiValueProps,
|
|
46
48
|
OnChangeValue,
|
|
49
|
+
OptionProps,
|
|
50
|
+
OptionsOrGroups,
|
|
47
51
|
PropsValue,
|
|
52
|
+
SingleValue,
|
|
53
|
+
SingleValueProps,
|
|
54
|
+
StylesConfig,
|
|
48
55
|
};
|
|
49
|
-
export {reactSelectComponents as components};
|
|
50
|
-
export {MenuListVirtualized};
|
|
51
56
|
|
|
52
57
|
//Group dummy for virtualized option-lists. For performance.
|
|
53
58
|
function GroupVirtualized() {
|
|
@@ -71,6 +76,7 @@ export type SelectProps<
|
|
|
71
76
|
virtualized?: boolean;
|
|
72
77
|
isCollectionMode?: IsMulti;
|
|
73
78
|
disabled?: boolean;
|
|
79
|
+
forbidValuesClearInCollnMode?: boolean;
|
|
74
80
|
};
|
|
75
81
|
|
|
76
82
|
export function SingleRowSelect<
|
|
@@ -110,6 +116,7 @@ export const Select = forwardRef(function Select<
|
|
|
110
116
|
onMenuOpen,
|
|
111
117
|
onMenuClose,
|
|
112
118
|
onChange,
|
|
119
|
+
forbidValuesClearInCollnMode,
|
|
113
120
|
...rest
|
|
114
121
|
}: SelectProps<Option, IsMulti, Group>,
|
|
115
122
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -161,11 +168,10 @@ export const Select = forwardRef(function Select<
|
|
|
161
168
|
},
|
|
162
169
|
[onKeyDown, menuOpenState]
|
|
163
170
|
);
|
|
164
|
-
|
|
165
171
|
const combinedStyles = useMemo(() => {
|
|
166
172
|
return combineStyles<Option, IsMulti, Group>([
|
|
167
173
|
componentsStyles,
|
|
168
|
-
virtualized ? virtualizedStyles :
|
|
174
|
+
virtualized ? virtualizedStyles : nonVirtualizedStyles,
|
|
169
175
|
zIndex ? zIndexStyles(zIndex) : {},
|
|
170
176
|
styles,
|
|
171
177
|
] as StylesConfig<Option, IsMulti, Group>[]);
|
|
@@ -183,7 +189,7 @@ export const Select = forwardRef(function Select<
|
|
|
183
189
|
menuPlacement={"auto"}
|
|
184
190
|
styles={combinedStyles}
|
|
185
191
|
isMulti={isCollectionMode}
|
|
186
|
-
backspaceRemovesValue={isCollectionMode}
|
|
192
|
+
backspaceRemovesValue={isCollectionMode && !forbidValuesClearInCollnMode}
|
|
187
193
|
tabSelectsValue={false}
|
|
188
194
|
components={{
|
|
189
195
|
Menu: Menu,
|
|
@@ -195,7 +201,7 @@ export const Select = forwardRef(function Select<
|
|
|
195
201
|
Read Option definition for more info
|
|
196
202
|
bug here: https://the.fibery.io/SoftDev/bug/Select-option-behaviour-is-incorrect-9413
|
|
197
203
|
*/
|
|
198
|
-
MultiValueRemove: ClearIndicator,
|
|
204
|
+
MultiValueRemove: isCollectionMode && forbidValuesClearInCollnMode ? NoClearIndicator : ClearIndicator,
|
|
199
205
|
NoOptionsMessage,
|
|
200
206
|
GroupHeading,
|
|
201
207
|
Option: optionsCount > FAST_OPTION_USAGE_THRESHOLD ? Option : OptionSlow,
|
|
@@ -253,15 +259,20 @@ export function CreatableSelectInner<
|
|
|
253
259
|
return countOptions<Option, Group>(rest.options);
|
|
254
260
|
}, [rest.options]);
|
|
255
261
|
|
|
262
|
+
const combinedStyles = useMemo(() => {
|
|
263
|
+
return combineStyles<Option, IsMulti, Group>([
|
|
264
|
+
componentsStyles,
|
|
265
|
+
virtualized ? virtualizedStyles : nonVirtualizedStyles,
|
|
266
|
+
styles,
|
|
267
|
+
] as StylesConfig<Option, IsMulti, Group>[]);
|
|
268
|
+
}, [styles, virtualized]);
|
|
269
|
+
|
|
256
270
|
return (
|
|
257
271
|
<BaseCreatableSelect
|
|
258
272
|
ref={ref}
|
|
259
273
|
menuPortalTarget={menuPortalTarget}
|
|
260
274
|
menuPlacement={"auto"}
|
|
261
|
-
styles={
|
|
262
|
-
componentsStyles as unknown as StylesConfig<Option, IsMulti, Group>,
|
|
263
|
-
styles,
|
|
264
|
-
])}
|
|
275
|
+
styles={combinedStyles}
|
|
265
276
|
isMulti={isCollectionMode}
|
|
266
277
|
backspaceRemovesValue={isCollectionMode}
|
|
267
278
|
tabSelectsValue={false}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import {useControllableState} from "@fibery/react/src/use-controllable-state";
|
|
1
2
|
import {css, cx} from "@linaria/core";
|
|
2
|
-
import {border, space, textStyles} from "../design-system";
|
|
3
|
-
import {inputOverrides} from "../antd/styles";
|
|
4
3
|
import React, {
|
|
5
4
|
ComponentProps,
|
|
6
5
|
ComponentType,
|
|
@@ -13,8 +12,12 @@ import React, {
|
|
|
13
12
|
useRef,
|
|
14
13
|
useState,
|
|
15
14
|
} from "react";
|
|
15
|
+
import {inputOverrides} from "../antd/styles";
|
|
16
|
+
import {border, space, textStyles} from "../design-system";
|
|
16
17
|
import {Popup} from "../popup";
|
|
17
18
|
import {$TSFixMe} from "../tsfixme";
|
|
19
|
+
import {useIsPhone} from "../use-is-phone";
|
|
20
|
+
import {Menu} from "./custom-select-partials/menu";
|
|
18
21
|
import {
|
|
19
22
|
ActionMeta,
|
|
20
23
|
combineStyles,
|
|
@@ -27,9 +30,6 @@ import {
|
|
|
27
30
|
StylesConfig,
|
|
28
31
|
} from "./index";
|
|
29
32
|
import {SelectControlSettingsProvider} from "./select-control-settings-context";
|
|
30
|
-
import {Menu} from "./custom-select-partials/menu";
|
|
31
|
-
import {useIsPhone} from "../use-is-phone";
|
|
32
|
-
import {useControllableState} from "@fibery/react/src/use-controllable-state";
|
|
33
33
|
|
|
34
34
|
const offset = [0, space.s4] as [number, number];
|
|
35
35
|
const popupHeightVH = 45;
|
|
@@ -53,10 +53,6 @@ const popupContainerClassName = css`
|
|
|
53
53
|
const popupClassName = css`
|
|
54
54
|
min-width: 320px;
|
|
55
55
|
max-width: 440px;
|
|
56
|
-
padding-top: ${popupPaddingTop}px;
|
|
57
|
-
padding-bottom: ${popupPaddingBottom}px;
|
|
58
|
-
padding-left: ${space.s8}px;
|
|
59
|
-
padding-right: ${space.s8}px;
|
|
60
56
|
`;
|
|
61
57
|
const mobileClassName = css`
|
|
62
58
|
padding-top: ${space.s12}px;
|
|
@@ -85,10 +81,8 @@ const valueClassName = css`
|
|
|
85
81
|
|
|
86
82
|
const titleClassName = css`
|
|
87
83
|
${textStyles.heading6}
|
|
88
|
-
padding-top: ${space.
|
|
89
|
-
padding-
|
|
90
|
-
padding-right: ${space.s8}px;
|
|
91
|
-
padding-bottom: ${space.s12}px;
|
|
84
|
+
padding-top: ${space.s12}px;
|
|
85
|
+
padding-inline: ${space.s12}px;
|
|
92
86
|
`;
|
|
93
87
|
|
|
94
88
|
export const valueMaxHeight = 116;
|
|
@@ -98,6 +92,8 @@ export const selectInPopupStyles = {
|
|
|
98
92
|
...props,
|
|
99
93
|
minWidth: 180,
|
|
100
94
|
width: "100%",
|
|
95
|
+
paddingTop: space.s6,
|
|
96
|
+
paddingInline: space.s6,
|
|
101
97
|
}),
|
|
102
98
|
option: (props: $TSFixMe) => ({
|
|
103
99
|
...props,
|
|
@@ -110,13 +106,16 @@ export const selectInPopupStyles = {
|
|
|
110
106
|
...props,
|
|
111
107
|
maxHeight: valueMaxHeight,
|
|
112
108
|
overflow: "auto",
|
|
109
|
+
margin: space.s2,
|
|
110
|
+
marginBottom: space.s4,
|
|
111
|
+
width: `calc(100% - ${space.s2 * 2}px)`,
|
|
112
|
+
borderRadius: border.radius4,
|
|
113
113
|
}),
|
|
114
114
|
menu: (props: $TSFixMe) => ({
|
|
115
115
|
...props,
|
|
116
116
|
minWidth: 100,
|
|
117
117
|
position: "static",
|
|
118
|
-
|
|
119
|
-
marginBottom: 0,
|
|
118
|
+
marginBlock: 0,
|
|
120
119
|
boxShadow: "none !important",
|
|
121
120
|
borderRadius: border.radius4,
|
|
122
121
|
}),
|
|
@@ -174,7 +173,7 @@ type Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = {
|
|
|
174
173
|
popupStyles?: string;
|
|
175
174
|
selectStyles?: StylesConfig<Option, IsMulti, Group>;
|
|
176
175
|
formatGroupLabel?: (group: Group) => ReactNode;
|
|
177
|
-
formatOptionLabel?: (option: Option) => ReactNode;
|
|
176
|
+
formatOptionLabel?: (option: Option, {context}: {context: "menu" | "value"}) => ReactNode;
|
|
178
177
|
components?: ComponentsConfig;
|
|
179
178
|
onInputChange?: (s: string, actionType: {action: string}) => void;
|
|
180
179
|
onFocus?: () => void;
|
|
@@ -183,6 +182,7 @@ type Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = {
|
|
|
183
182
|
onMenuClose?: () => void | boolean;
|
|
184
183
|
getPopupContainer?: () => HTMLElement;
|
|
185
184
|
onSelectKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
185
|
+
forbidValuesClearInCollnMode?: boolean;
|
|
186
186
|
otherSelectProps?: Record<string, unknown>;
|
|
187
187
|
};
|
|
188
188
|
|
|
@@ -221,6 +221,7 @@ function SelectInPopoverInner<Option, IsMulti extends boolean, Group extends Gro
|
|
|
221
221
|
getPopupContainer,
|
|
222
222
|
onSelectKeyDown,
|
|
223
223
|
otherSelectProps,
|
|
224
|
+
forbidValuesClearInCollnMode,
|
|
224
225
|
} = props;
|
|
225
226
|
const [triggerElement, setTriggerElement] = useState<HTMLDivElement | null>(null);
|
|
226
227
|
const [visible, setVisible] = useControllableState({
|
|
@@ -421,6 +422,7 @@ function SelectInPopoverInner<Option, IsMulti extends boolean, Group extends Gro
|
|
|
421
422
|
IndicatorSeparator: null,
|
|
422
423
|
Menu: mergedComponents.Menu as $TSFixMe,
|
|
423
424
|
}}
|
|
425
|
+
forbidValuesClearInCollnMode={forbidValuesClearInCollnMode}
|
|
424
426
|
/>
|
|
425
427
|
</SelectControlSettingsProvider>
|
|
426
428
|
</Popup>
|
package/src/select/styles.ts
CHANGED
|
@@ -2,9 +2,9 @@ import {css} from "@linaria/core";
|
|
|
2
2
|
import type {ControlProps, CSSObjectWithLabel, StylesConfig} from "react-select";
|
|
3
3
|
import {inputOverrides} from "../antd/styles";
|
|
4
4
|
import {layout, space, themeVars} from "../design-system";
|
|
5
|
-
import {OptionNulledStyles, OptionNulledVitualizedStyles} from "./custom-select-partials/option";
|
|
6
|
-
import {MenuListNulledStyles, MenuNulledStyles} from "./custom-select-partials/menu";
|
|
7
5
|
import {groupHeadingNulledStyles} from "./custom-select-partials/group-heading";
|
|
6
|
+
import {MenuListNulledStyles, MenuNulledStyles} from "./custom-select-partials/menu";
|
|
7
|
+
import {OptionNulledStyles, OptionNulledVitualizedStyles} from "./custom-select-partials/option";
|
|
8
8
|
|
|
9
9
|
export const expanderExpandedStyle = css`
|
|
10
10
|
transform: rotate(180deg);
|
|
@@ -50,6 +50,14 @@ export const virtualizedStyles: StylesConfig = {
|
|
|
50
50
|
}),
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
export const nonVirtualizedStyles: StylesConfig = {
|
|
54
|
+
menuList: (provided) => ({
|
|
55
|
+
...provided,
|
|
56
|
+
paddingTop: 6,
|
|
57
|
+
paddingBottom: 6,
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
|
|
53
61
|
export const zIndexStyles = (zIndex: number): StylesConfig => ({
|
|
54
62
|
menuPortal: (provided) => ({
|
|
55
63
|
...provided,
|
package/src/toast/toast-queue.ts
CHANGED
|
@@ -93,7 +93,7 @@ export const makeToastQueue = ({maxActiveToasts = 1, onToastAdd, transformToast}
|
|
|
93
93
|
getActiveToasts() {
|
|
94
94
|
return activeToasts;
|
|
95
95
|
},
|
|
96
|
-
|
|
96
|
+
addBottomOffset: (bottomOffset: number) => {
|
|
97
97
|
const id = `${Math.random()}`;
|
|
98
98
|
bottomOffsets.push({id, bottomOffset});
|
|
99
99
|
pubSub.publish();
|
package/src/tooltip.tsx
CHANGED
|
@@ -4,6 +4,8 @@ import {forwardRef, type ReactNode, type SyntheticEvent} from "react";
|
|
|
4
4
|
import {border, fontWeight, lineHeight, space, themeVars, tooltipDelay} from "./design-system";
|
|
5
5
|
import {ShortcutBadge} from "./shortcut-badge";
|
|
6
6
|
|
|
7
|
+
const isFlagPresent = (flag: string) => new RegExp(`[?&]${flag}\\b`).test(window.location.search);
|
|
8
|
+
|
|
7
9
|
const preventDefaultAndStopPropagation = (e: SyntheticEvent) => {
|
|
8
10
|
e.preventDefault();
|
|
9
11
|
e.stopPropagation();
|
|
@@ -175,6 +177,10 @@ export const Tooltip = forwardRef<HTMLButtonElement, TooltipProps>(
|
|
|
175
177
|
}
|
|
176
178
|
: null;
|
|
177
179
|
|
|
180
|
+
if (isFlagPresent("no-tooltips")) {
|
|
181
|
+
return <>{children}</>;
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
return (
|
|
179
185
|
<TooltipPrimitive.Root
|
|
180
186
|
delayDuration={instant ? 0 : tooltipDelay.enter}
|