@fibery/ui-kit 1.36.0 → 1.36.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.
- package/CHANGELOG.md +17 -0
- package/package.json +3 -3
- package/scripts/generate-icons.mjs +15 -1
- package/src/actions-menu/actions-menu-item.tsx +2 -2
- package/src/actions-menu/actions-menu-sub-command-menu.tsx +3 -0
- package/src/avatar.tsx +26 -12
- package/src/beta-badge.tsx +17 -0
- package/src/button/base-button.tsx +3 -3
- package/src/command-menu/index.tsx +15 -21
- package/src/command-menu/nested-command-menu.tsx +356 -0
- package/src/context-menu/index.tsx +3 -3
- package/src/date-picker/relative-date-picker.tsx +20 -9
- package/src/design-system.ts +18 -14
- package/src/dropdown-menu/index.tsx +1 -1
- package/src/format-date-from-now.ts +1 -1
- package/src/icons/ast/Anthropic.ts +8 -0
- package/src/icons/ast/Csv.ts +8 -0
- package/src/icons/ast/DateRange.ts +8 -0
- package/src/icons/ast/FiberyMono.ts +1 -1
- package/src/icons/ast/OpenAi.ts +8 -0
- package/src/icons/ast/ReadOnly.ts +8 -0
- package/src/icons/ast/SpaceList.ts +8 -0
- package/src/icons/ast/SuggestIntegration.ts +8 -0
- package/src/icons/ast/index.tsx +7 -0
- package/src/icons/react/Anthropic.tsx +13 -0
- package/src/icons/react/Csv.tsx +13 -0
- package/src/icons/react/DateRange.tsx +13 -0
- package/src/icons/react/OpenAi.tsx +13 -0
- package/src/icons/react/ReadOnly.tsx +13 -0
- package/src/icons/react/SpaceList.tsx +13 -0
- package/src/icons/react/SuggestIntegration.tsx +13 -0
- package/src/icons/react/index.tsx +7 -0
- package/src/icons/svg/anthropic.svg +15 -0
- package/src/icons/svg/csv.svg +3 -0
- package/src/icons/svg/date-range.svg +4 -0
- package/src/icons/svg/fibery-mono.svg +6 -1
- package/src/icons/svg/open-ai.svg +8 -0
- package/src/icons/svg/read-only.svg +6 -0
- package/src/icons/svg/space-list.svg +4 -0
- package/src/icons/svg/suggest-integration.svg +4 -0
- package/src/icons/types.ts +2 -2
- package/src/loaders.tsx +28 -23
- package/src/logo.tsx +13 -45
- package/src/new-badge.tsx +8 -6
- package/src/number-input/number-input.tsx +37 -56
- package/src/select/custom-select-partials/group-heading.tsx +24 -1
- package/src/select/custom-select-partials/option.tsx +17 -11
- package/src/select/select-in-popover.tsx +3 -1
- package/src/select/util.ts +2 -1
- package/src/toast/utils/toastify-item-name.ts +1 -1
- package/src/type-badge-box.tsx +4 -2
- package/src/type-badge.tsx +20 -12
- package/src/unit/primitive.tsx +3 -0
- package/src/unit/styles.ts +4 -0
- package/src/unit/types.ts +1 -0
package/src/loaders.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {css, cx} from "@linaria/core";
|
|
2
2
|
import {styled} from "@linaria/react";
|
|
3
|
-
import {ReactNode, memo} from "react";
|
|
3
|
+
import {ReactNode, memo, useMemo} from "react";
|
|
4
4
|
import {IconBaseProps} from "./icons/types";
|
|
5
5
|
import {border, layout, space, textStyles, themeVars} from "./design-system";
|
|
6
6
|
import {getShiftStyle} from "./icons/get-shift-style";
|
|
@@ -104,35 +104,40 @@ const ContainerSpinner = styled.div<{containerSize: number}>`
|
|
|
104
104
|
line-height: ${(props) => props.containerSize}px;
|
|
105
105
|
`;
|
|
106
106
|
|
|
107
|
-
type
|
|
107
|
+
type Props = {
|
|
108
108
|
size?: number;
|
|
109
109
|
containerSize?: number;
|
|
110
110
|
width?: number;
|
|
111
111
|
color?: string;
|
|
112
112
|
backgroundColor?: string;
|
|
113
113
|
};
|
|
114
|
-
export const Spinner = memo<SpinnerProps>(function Spinner({
|
|
115
|
-
size = 20,
|
|
116
|
-
containerSize = 15,
|
|
117
|
-
width = 2,
|
|
118
|
-
color = "#000000",
|
|
119
|
-
backgroundColor = "#FFFFFF",
|
|
120
|
-
}) {
|
|
121
|
-
const spinnerStyle = {
|
|
122
|
-
width: size,
|
|
123
|
-
height: size,
|
|
124
|
-
...getShiftStyle({elementSize: size, containerSize}),
|
|
125
|
-
borderWidth: width,
|
|
126
|
-
borderColor: backgroundColor,
|
|
127
|
-
borderTopColor: color,
|
|
128
|
-
};
|
|
129
114
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
115
|
+
export const Spinner = memo<Props>(
|
|
116
|
+
({
|
|
117
|
+
size = 20,
|
|
118
|
+
containerSize = 15,
|
|
119
|
+
width = 2,
|
|
120
|
+
color = themeVars.iconColor,
|
|
121
|
+
backgroundColor = themeVars.badgeBgColor,
|
|
122
|
+
}) => {
|
|
123
|
+
const style = useMemo(() => {
|
|
124
|
+
return {
|
|
125
|
+
width: size,
|
|
126
|
+
height: size,
|
|
127
|
+
...getShiftStyle({elementSize: size, containerSize}),
|
|
128
|
+
borderWidth: width,
|
|
129
|
+
borderColor: backgroundColor,
|
|
130
|
+
borderTopColor: color,
|
|
131
|
+
};
|
|
132
|
+
}, [backgroundColor, color, containerSize, size, width]);
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<ContainerSpinner containerSize={containerSize}>
|
|
136
|
+
<div style={style} className={spinner} />
|
|
137
|
+
</ContainerSpinner>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
);
|
|
136
141
|
|
|
137
142
|
export const LoadingTreeMenuItem = ({
|
|
138
143
|
color,
|
package/src/logo.tsx
CHANGED
|
@@ -8,63 +8,31 @@ interface LogoProps {
|
|
|
8
8
|
|
|
9
9
|
export const Logo: FC<LogoProps> = ({size = 40}) => {
|
|
10
10
|
return (
|
|
11
|
-
<svg width={size} height={size} viewBox="0 0
|
|
11
|
+
<svg width={size} height={size} viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
12
12
|
<path
|
|
13
|
-
d="
|
|
14
|
-
fill="
|
|
13
|
+
d="M4.03423 14.4218C3.21412 13.9208 2.98021 12.7899 3.50892 12.0007L9.78271 2.68903C10.3144 1.96674 11.3497 1.78689 12.0902 2.296C12.8324 2.80633 13.0464 3.84401 12.577 4.61037L6.30323 13.9221C5.81148 14.6516 4.79323 14.8855 4.03423 14.4218Z"
|
|
14
|
+
fill="#4FC5B3"
|
|
15
15
|
/>
|
|
16
16
|
<path
|
|
17
|
-
d="
|
|
18
|
-
fill="
|
|
17
|
+
d="M12.5824 5.76052L14.4262 5.62076C15.0707 5.57197 15.7022 5.909 16.0235 6.47175C16.4824 7.27568 16.2062 8.3398 15.4042 8.80787L7.37161 13.4944L12.5824 5.76052Z"
|
|
18
|
+
fill="#4FC5B3"
|
|
19
19
|
/>
|
|
20
20
|
<path
|
|
21
|
-
d="
|
|
22
|
-
fill="
|
|
21
|
+
d="M7.9007 15.2941L7.54998 14.143L9.39081 13.069L10.9608 13.6928L11.1421 14.2861C11.4113 15.1703 10.9111 16.1473 10.0244 16.4244C9.13418 16.6992 8.17086 16.1782 7.9007 15.2941Z"
|
|
22
|
+
fill="#4FC5B3"
|
|
23
23
|
/>
|
|
24
24
|
<path
|
|
25
|
-
d="
|
|
26
|
-
fill="
|
|
25
|
+
d="M13.8573 10.463L10.1048 12.6524L13.1951 13.8803C14.1762 14.262 15.2829 13.6203 15.4739 12.6003C15.6223 11.8078 15.1831 10.9898 14.4313 10.6908L13.8573 10.463Z"
|
|
26
|
+
fill="#4FC5B3"
|
|
27
27
|
/>
|
|
28
28
|
<path
|
|
29
|
-
d="
|
|
30
|
-
fill="
|
|
29
|
+
d="M6.62886 6.21191L4.19346 9.82661C3.94456 9.84546 3.69329 9.87829 3.44344 9.87829C2.53771 9.87954 1.78415 9.13161 1.75116 8.23166C1.71817 7.33154 2.41483 6.52941 3.31826 6.46286L6.62886 6.21191Z"
|
|
30
|
+
fill="#4FC5B3"
|
|
31
31
|
/>
|
|
32
32
|
<path
|
|
33
|
-
d="
|
|
34
|
-
fill="
|
|
33
|
+
d="M7.47702 2.86321L8.28896 3.74803L7.052 5.58397L5.46788 5.70755L4.99456 5.19028C4.36761 4.50647 4.40795 3.40642 5.08509 2.77166C5.76095 2.13811 6.85128 2.1807 7.47702 2.86321Z"
|
|
34
|
+
fill="#4FC5B3"
|
|
35
35
|
/>
|
|
36
|
-
<path
|
|
37
|
-
d="M32.081 59.9018H32.0813C32.7547 59.9028 33.4245 59.8022 34.0686 59.6033C35.7574 59.0755 37.1703 57.8914 37.9966 56.3106C38.823 54.7296 38.9949 52.8816 38.4745 51.1724L32.081 59.9018ZM32.081 59.9018C30.6542 59.9042 29.2641 59.4439 28.115 58.5882M32.081 59.9018L28.115 58.5882M51.6889 36.8545C53.1333 37.4289 54.3344 38.4952 55.0848 39.8695C55.8353 41.2439 56.0879 42.8401 55.7991 44.3828C55.5103 45.9255 54.6981 47.3177 53.503 48.3194C52.3077 49.3212 50.8045 49.8741 49.2527 49.8749L49.2518 49.8749C48.4196 49.8829 47.5933 49.7319 46.8164 49.4297L46.8166 49.4297L46.7804 49.521C47.569 49.8278 48.4078 49.9812 49.2528 49.973C50.8279 49.9722 52.3533 49.411 53.566 48.3946C54.7787 47.3782 55.6026 45.9658 55.8956 44.4009C56.1886 42.836 55.9323 41.2168 55.171 39.8225C54.4096 38.4282 53.191 37.3463 51.7252 36.7633M51.6889 36.8545L51.689 36.8545L51.7252 36.7633M51.6889 36.8545L51.7252 36.7633M51.6889 36.8545L49.4371 35.9608M51.7252 36.7633L49.4289 35.852L49.4783 35.9367L49.4371 35.9608M49.4371 35.9608L34.6426 44.5926M49.4371 35.9608L34.6426 44.5926M34.6426 44.5926L46.816 49.4295L34.6426 44.5926ZM20.3208 18.9605L20.3907 18.8568L7.273 19.8511C5.52536 19.9798 3.89531 20.7893 2.7261 22.109C1.55688 23.4287 0.939748 25.1557 1.00465 26.9263C1.06954 28.6969 1.81141 30.373 3.07402 31.6016C4.33664 32.8302 6.02147 33.5154 7.77374 33.5129L20.4456 18.951L20.3208 18.9605ZM20.3208 18.9605L7.28042 19.949L7.28021 19.949C5.55826 20.0758 3.95193 20.8734 2.79956 22.1741C1.64717 23.4748 1.03875 25.1772 1.10273 26.9227C1.16671 28.6683 1.89807 30.3204 3.14247 31.5312C4.38684 32.7421 6.0471 33.4172 7.77361 33.4148H7.77374C7.94196 33.4148 8.10911 33.4103 8.27562 33.397L8.27601 33.397L10.719 33.2118M20.3208 18.9605L10.719 33.2118M10.719 33.2118L10.6924 33.2512L10.7738 33.3061L10.7664 33.2082L10.719 33.2118ZM28.115 58.5882C26.9658 57.7326 26.1182 56.5268 25.6967 55.1477L28.115 58.5882ZM52.819 16.5904L52.8194 16.5904C53.2023 16.6245 53.5841 16.6923 53.9605 16.7943C55.6681 17.2571 57.1244 18.387 58.0086 19.9358C58.8928 21.4846 59.1324 23.3253 58.6745 25.0529C58.2166 26.7804 57.0988 28.253 55.5675 29.1468L23.8076 47.6769L44.3843 17.1365L51.7122 16.581C52.0816 16.553 52.4518 16.5563 52.819 16.5904ZM52.8281 16.4926C53.2167 16.5272 53.6042 16.596 53.9861 16.6995C55.7192 17.1692 57.1968 18.3158 58.0938 19.8871C58.9909 21.4584 59.2338 23.3256 58.7693 25.078C58.3048 26.8305 57.1709 28.3245 55.617 29.2316L52.8281 16.4926ZM37.7633 48.8446L38.4745 51.1723L25.6967 55.1476L24.3164 50.6173L31.5714 46.3844L37.7633 48.8446ZM23.8357 5.51852L23.8358 5.51855L27.0312 9.00085L22.1531 16.2411L15.9116 16.728L14.0506 14.6942L14.0506 14.6942C12.8474 13.3818 12.2089 11.6397 12.2758 9.85108C12.3428 8.06243 13.1097 6.37417 14.4075 5.15761C15.7052 3.94109 17.4275 3.29586 19.1955 3.36352C20.9634 3.43118 22.6326 4.20622 23.8357 5.51852ZM13.6156 52.5737C12.4073 52.5706 11.2225 52.2352 10.1881 51.6033C9.15366 50.9715 8.30859 50.0669 7.74349 48.9863C7.17839 47.9058 6.9146 46.6901 6.98044 45.4694C7.04628 44.2488 7.43925 43.0694 8.11715 42.0575C8.11717 42.0575 8.1172 42.0574 8.11722 42.0574L33.2111 4.81244C34.2375 3.41902 35.7561 2.48031 37.45 2.1918C39.1446 1.90318 40.884 2.28749 42.3052 3.26472C43.7265 4.24198 44.7199 5.73676 45.0775 7.43724C45.4351 9.13704 45.1298 10.9107 44.2255 12.3882L19.1315 49.6333C18.5192 50.5416 17.6963 51.2845 16.7348 51.797C15.7733 52.3096 14.7024 52.5762 13.6156 52.5737Z"
|
|
38
|
-
stroke="white"
|
|
39
|
-
strokeOpacity={0.1}
|
|
40
|
-
strokeWidth={0.196305}
|
|
41
|
-
/>
|
|
42
|
-
<defs>
|
|
43
|
-
<linearGradient id="paint0_linear_2845_2276" x1={30} y1={2} x2={30} y2={60} gradientUnits="userSpaceOnUse">
|
|
44
|
-
<stop stopColor="#7FE8D4" />
|
|
45
|
-
<stop offset={1} stopColor="#1FA192" />
|
|
46
|
-
</linearGradient>
|
|
47
|
-
<linearGradient id="paint1_linear_2845_2276" x1={30} y1={2} x2={30} y2={60} gradientUnits="userSpaceOnUse">
|
|
48
|
-
<stop stopColor="#7FE8D4" />
|
|
49
|
-
<stop offset={1} stopColor="#1FA192" />
|
|
50
|
-
</linearGradient>
|
|
51
|
-
<linearGradient id="paint2_linear_2845_2276" x1={30} y1={2} x2={30} y2={60} gradientUnits="userSpaceOnUse">
|
|
52
|
-
<stop stopColor="#7FE8D4" />
|
|
53
|
-
<stop offset={1} stopColor="#1FA192" />
|
|
54
|
-
</linearGradient>
|
|
55
|
-
<linearGradient id="paint3_linear_2845_2276" x1={30} y1={2} x2={30} y2={60} gradientUnits="userSpaceOnUse">
|
|
56
|
-
<stop stopColor="#7FE8D4" />
|
|
57
|
-
<stop offset={1} stopColor="#1FA192" />
|
|
58
|
-
</linearGradient>
|
|
59
|
-
<linearGradient id="paint4_linear_2845_2276" x1={30} y1={2} x2={30} y2={60} gradientUnits="userSpaceOnUse">
|
|
60
|
-
<stop stopColor="#7FE8D4" />
|
|
61
|
-
<stop offset={1} stopColor="#1FA192" />
|
|
62
|
-
</linearGradient>
|
|
63
|
-
<linearGradient id="paint5_linear_2845_2276" x1={30} y1={2} x2={30} y2={60} gradientUnits="userSpaceOnUse">
|
|
64
|
-
<stop stopColor="#7FE8D4" />
|
|
65
|
-
<stop offset={1} stopColor="#1FA192" />
|
|
66
|
-
</linearGradient>
|
|
67
|
-
</defs>
|
|
68
36
|
</svg>
|
|
69
37
|
);
|
|
70
38
|
};
|
package/src/new-badge.tsx
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
|
-
import {space, textStyles, themeVars} from "./design-system";
|
|
2
|
+
import {fontWeight, space, textStyles, themeVars} from "./design-system";
|
|
3
3
|
|
|
4
4
|
const newBadgeStyle = css`
|
|
5
5
|
${textStyles.heading7}
|
|
6
|
+
text-transform: none;
|
|
7
|
+
font-weight: ${fontWeight.medium};
|
|
6
8
|
display: inline-block;
|
|
7
|
-
padding: ${space.
|
|
8
|
-
color: ${themeVars.
|
|
9
|
-
background-color: ${themeVars.
|
|
10
|
-
border:
|
|
9
|
+
padding: ${space.s2}px 4.5px ${space.s2}px 5px;
|
|
10
|
+
color: ${themeVars.colorTextBadgeNeutral};
|
|
11
|
+
background-color: ${themeVars.colorBgBadgeNeutral};
|
|
12
|
+
//border: 0.5px solid ${themeVars.colorBorderButtonOutlineAccentDefault};
|
|
11
13
|
vertical-align: text-top;
|
|
12
|
-
border-radius:
|
|
14
|
+
border-radius: 4px;
|
|
13
15
|
`;
|
|
14
16
|
|
|
15
17
|
type Props = {children: React.ReactNode};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {textStyles, themeVars} from "../../src/design-system";
|
|
2
2
|
import {css} from "@linaria/core";
|
|
3
|
-
import {useCallback, useMemo, useRef, useState
|
|
3
|
+
import {ComponentProps, forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState} from "react";
|
|
4
4
|
import {formatValue, getStep, parseValue} from "./index";
|
|
5
5
|
import _ from "lodash";
|
|
6
6
|
import {add, sub} from "./decimal";
|
|
@@ -10,9 +10,9 @@ import {stopPropagation} from "@fibery/react/src/stop-propagation";
|
|
|
10
10
|
import cx from "classnames";
|
|
11
11
|
import {invalidInputStyle} from "./edit-unit-styles";
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const invalidCss = css``;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const inputContainerCss = css`
|
|
16
16
|
position: relative;
|
|
17
17
|
input {
|
|
18
18
|
background-color: ${themeVars.transparent};
|
|
@@ -26,31 +26,30 @@ export const inputContainerClassName = css`
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
&.${
|
|
29
|
+
&.${invalidCss} {
|
|
30
30
|
${invalidInputStyle}
|
|
31
31
|
}
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
>(
|
|
34
|
+
type NumberFormat = "Number" | "Money" | "Percent";
|
|
35
|
+
|
|
36
|
+
type Props = ComponentProps<typeof InputNumber> & {
|
|
37
|
+
value: string | number | null;
|
|
38
|
+
numberFormat: NumberFormat;
|
|
39
|
+
format?: (value: string | number) => string;
|
|
40
|
+
numberPrecision: number;
|
|
41
|
+
placeholder: string;
|
|
42
|
+
autoFocus: boolean;
|
|
43
|
+
valueWrapperClassName?: string;
|
|
44
|
+
decimalSeparator?: string;
|
|
45
|
+
invalid?: boolean;
|
|
46
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
47
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
48
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
49
|
+
onChange: (value: string | number | null) => void;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const NumberInlineInput = forwardRef<HTMLInputElement, Props>(
|
|
54
53
|
(
|
|
55
54
|
{
|
|
56
55
|
value,
|
|
@@ -69,23 +68,15 @@ export const NumberInlineInput = forwardRef<
|
|
|
69
68
|
},
|
|
70
69
|
ref
|
|
71
70
|
) => {
|
|
72
|
-
const isEditing = true;
|
|
73
|
-
const handleFocus: React.FocusEventHandler<HTMLInputElement> = useCallback(
|
|
74
|
-
(e) => {
|
|
75
|
-
if (onFocus) {
|
|
76
|
-
onFocus(e);
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
[onFocus]
|
|
80
|
-
);
|
|
81
|
-
|
|
82
71
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
83
72
|
const [inputContainerRef, setInputContainerRef] = useState<HTMLDivElement | null>(null);
|
|
84
73
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
useImperativeHandle(ref, () => inputRef.current!, []);
|
|
75
|
+
|
|
76
|
+
const handleBlur = useCallback(
|
|
77
|
+
(e: React.FocusEvent<HTMLInputElement>) => {
|
|
78
|
+
if (e.relatedTarget && inputContainerRef && !inputContainerRef.contains(e.relatedTarget)) {
|
|
79
|
+
onBlur?.(e);
|
|
89
80
|
}
|
|
90
81
|
},
|
|
91
82
|
[inputContainerRef, onBlur]
|
|
@@ -101,14 +92,7 @@ export const NumberInlineInput = forwardRef<
|
|
|
101
92
|
);
|
|
102
93
|
|
|
103
94
|
const handleStep = useCallback(
|
|
104
|
-
(
|
|
105
|
-
newValue: string | number,
|
|
106
|
-
{
|
|
107
|
-
type,
|
|
108
|
-
}: {
|
|
109
|
-
type: "up" | "down";
|
|
110
|
-
}
|
|
111
|
-
) => {
|
|
95
|
+
(newValue: string | number, {type}: {type: "up" | "down"}) => {
|
|
112
96
|
inputRef.current?.focus();
|
|
113
97
|
const step = getStep(numberFormat);
|
|
114
98
|
if (type === "up") {
|
|
@@ -119,29 +103,26 @@ export const NumberInlineInput = forwardRef<
|
|
|
119
103
|
},
|
|
120
104
|
[numberFormat, onChange, value]
|
|
121
105
|
);
|
|
122
|
-
useImperativeHandle(ref, () => inputRef.current!, []);
|
|
123
106
|
|
|
124
107
|
const formattedValue = useMemo(() => {
|
|
108
|
+
const isEditing = true;
|
|
125
109
|
return formatValue(value, isEditing, numberFormat, format);
|
|
126
|
-
}, [value,
|
|
110
|
+
}, [value, numberFormat, format]);
|
|
127
111
|
|
|
128
112
|
return (
|
|
129
|
-
<div
|
|
130
|
-
ref={setInputContainerRef}
|
|
131
|
-
className={cx(valueWrapperClassName, inputContainerClassName, invalid && invalidClassName)}
|
|
132
|
-
>
|
|
113
|
+
<div ref={setInputContainerRef} className={cx(valueWrapperClassName, inputContainerCss, invalid && invalidCss)}>
|
|
133
114
|
<InputNumber
|
|
134
115
|
autoFocus={autoFocus}
|
|
135
116
|
ref={inputRef}
|
|
136
117
|
value={formattedValue}
|
|
137
|
-
onFocus={handleFocus}
|
|
138
|
-
onBlur={handleBlur}
|
|
139
|
-
onChange={handleChange}
|
|
140
|
-
onKeyDown={onKeyDown}
|
|
141
118
|
type="text"
|
|
142
119
|
placeholder={placeholder}
|
|
143
120
|
upHandler={<StepButton type={"up"} />}
|
|
144
121
|
downHandler={<StepButton type={"down"} />}
|
|
122
|
+
onFocus={onFocus}
|
|
123
|
+
onBlur={handleBlur}
|
|
124
|
+
onChange={handleChange}
|
|
125
|
+
onKeyDown={onKeyDown}
|
|
145
126
|
onStep={handleStep}
|
|
146
127
|
onClick={stopPropagation}
|
|
147
128
|
{...rest}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
|
-
import {
|
|
2
|
+
import {components, GroupHeadingProps} from "react-select";
|
|
3
3
|
import {layout, space, textStyles, themeVars} from "../../design-system";
|
|
4
4
|
import {TooltipIfOverflown} from "../../tooltip-if-overflown";
|
|
5
5
|
import {GroupBase} from "../index";
|
|
@@ -47,6 +47,7 @@ const GroupDivider = () => (
|
|
|
47
47
|
<div className={groupDividerStyle}></div>
|
|
48
48
|
</div>
|
|
49
49
|
);
|
|
50
|
+
|
|
50
51
|
export function GroupHeading<
|
|
51
52
|
Option,
|
|
52
53
|
IsMulti extends boolean = false,
|
|
@@ -77,3 +78,25 @@ export function GroupHeading<
|
|
|
77
78
|
</components.GroupHeading>
|
|
78
79
|
);
|
|
79
80
|
}
|
|
81
|
+
|
|
82
|
+
// probably can be united with "GroupHeading" above.
|
|
83
|
+
export function GroupSeparator<
|
|
84
|
+
Option,
|
|
85
|
+
IsMulti extends boolean = false,
|
|
86
|
+
Group extends GroupBase<Option> = GroupBase<Option>
|
|
87
|
+
>({...props}: GroupHeadingProps<Option, IsMulti, Group>) {
|
|
88
|
+
// Hide separators when searching
|
|
89
|
+
if (!props.data.separator || props.selectProps.inputValue) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<hr
|
|
95
|
+
style={{margin: `${((props.data.separatorMargin || space.s8) - 1) / 2}px 0`}}
|
|
96
|
+
className={css`
|
|
97
|
+
border: none;
|
|
98
|
+
border-bottom: 1px solid ${themeVars.separatorColor};
|
|
99
|
+
`}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {OptionProps, components} from "react-select";
|
|
2
|
-
import {GroupBase} from "../index";
|
|
3
1
|
import {css} from "@linaria/core";
|
|
4
|
-
import {layout, space} from "../../design-system";
|
|
5
|
-
import {ListRowContent, ListRowSurface} from "../../lists/list-row-surface";
|
|
6
2
|
import cn from "classnames";
|
|
7
3
|
import {ComponentProps, useMemo} from "react";
|
|
4
|
+
import {components, OptionProps} from "react-select";
|
|
5
|
+
import {layout, space} from "../../design-system";
|
|
6
|
+
import {ListRowContent, ListRowSurface} from "../../lists/list-row-surface";
|
|
8
7
|
import {TooltipIfOverflown} from "../../tooltip-if-overflown";
|
|
8
|
+
import {GroupBase} from "../index";
|
|
9
9
|
import {isPureTextChildren} from "../util";
|
|
10
10
|
|
|
11
11
|
export const OptionNulledVitualizedStyles = {
|
|
@@ -22,16 +22,22 @@ export const OptionNulledStyles = {
|
|
|
22
22
|
lineHeight: "",
|
|
23
23
|
color: "",
|
|
24
24
|
};
|
|
25
|
+
|
|
25
26
|
const OptionRootClass = css`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
:where(&) {
|
|
28
|
+
padding: 0 ${space.s6}px;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: stretch;
|
|
31
|
+
justify-content: stretch;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
max-width: 100%;
|
|
34
|
+
}
|
|
32
35
|
`;
|
|
33
36
|
const OptionWithTextContent = css`
|
|
34
|
-
|
|
37
|
+
:where(&) {
|
|
38
|
+
padding-left: ${space.s6}px;
|
|
39
|
+
padding-right: ${space.s6}px;
|
|
40
|
+
}
|
|
35
41
|
`;
|
|
36
42
|
|
|
37
43
|
/**
|
|
@@ -50,7 +50,7 @@ const popupContainerClassName = css`
|
|
|
50
50
|
align-items: flex-end;
|
|
51
51
|
}
|
|
52
52
|
`;
|
|
53
|
-
const popupClassName = css`
|
|
53
|
+
export const popupClassName = css`
|
|
54
54
|
min-width: 320px;
|
|
55
55
|
max-width: 440px;
|
|
56
56
|
`;
|
|
@@ -125,6 +125,8 @@ export type TriggerProps = {
|
|
|
125
125
|
innerRef: React.Ref<HTMLDivElement>;
|
|
126
126
|
children: ReactNode;
|
|
127
127
|
onClick?: React.MouseEventHandler;
|
|
128
|
+
iconStart?: ReactNode;
|
|
129
|
+
pending?: boolean;
|
|
128
130
|
onKeyDown?: React.KeyboardEventHandler;
|
|
129
131
|
disabled?: boolean;
|
|
130
132
|
};
|
package/src/select/util.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {GroupBase as ReactSelectGroupBase, OptionsOrGroups, SelectInstance} from "react-select";
|
|
2
2
|
import {isObject} from "lodash";
|
|
3
3
|
import {Children, createContext, ReactNode, RefObject} from "react";
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* API used by ReactSelect internal partials (at least VirtualizedMenuList).
|
|
6
7
|
*/
|
|
7
8
|
export const ReactSelectRefContext = createContext<RefObject<SelectInstance>>({current: null});
|
|
8
|
-
export type GroupBase<T> = ReactSelectGroupBase<T> & {separator?: boolean};
|
|
9
|
+
export type GroupBase<T> = ReactSelectGroupBase<T> & {separator?: boolean; separatorMargin?: number};
|
|
9
10
|
export function isGroup<Option, Group extends GroupBase<Option>>(
|
|
10
11
|
optionOrGroup: Option | Group
|
|
11
12
|
): optionOrGroup is Group {
|
package/src/type-badge-box.tsx
CHANGED
|
@@ -8,9 +8,10 @@ type Props = {
|
|
|
8
8
|
height: number;
|
|
9
9
|
typeObject: {title: string};
|
|
10
10
|
children: ReactNode;
|
|
11
|
+
className?: string;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
export const TypeBadgeBox = ({width, height, typeObject, children}: Props) => {
|
|
14
|
+
export const TypeBadgeBox = ({width, height, typeObject, children, className}: Props) => {
|
|
14
15
|
const abbr = makeAbbreviation(typeObject.title);
|
|
15
16
|
|
|
16
17
|
return (
|
|
@@ -33,7 +34,8 @@ export const TypeBadgeBox = ({width, height, typeObject, children}: Props) => {
|
|
|
33
34
|
& > div {
|
|
34
35
|
mask-image: linear-gradient(90deg, #000 60%, rgba(0, 0, 0, 0.4));
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
`,
|
|
38
|
+
className
|
|
37
39
|
)}
|
|
38
40
|
>
|
|
39
41
|
{children}
|
package/src/type-badge.tsx
CHANGED
|
@@ -123,6 +123,9 @@ const clickableStyle = css`
|
|
|
123
123
|
const fadedStyle = css`
|
|
124
124
|
opacity: ${opacity.opacity25};
|
|
125
125
|
`;
|
|
126
|
+
const noColorStyle = css`
|
|
127
|
+
opacity: ${opacity.opacity60};
|
|
128
|
+
`;
|
|
126
129
|
|
|
127
130
|
export const makeDescription = (typeObject: {description?: string | null}): string | null => {
|
|
128
131
|
return typeObject.description || null;
|
|
@@ -135,7 +138,7 @@ export const makeAbbreviation = (title = "") =>
|
|
|
135
138
|
.join("");
|
|
136
139
|
|
|
137
140
|
type TypeBadgeProps = {
|
|
138
|
-
color: string;
|
|
141
|
+
color: string | null;
|
|
139
142
|
onMouseDown?: () => void;
|
|
140
143
|
onMouseEnter?: React.MouseEventHandler;
|
|
141
144
|
onMouseLeave?: React.MouseEventHandler;
|
|
@@ -189,25 +192,27 @@ export const TypeBadge = memo(
|
|
|
189
192
|
|
|
190
193
|
const theme = useTheme();
|
|
191
194
|
|
|
195
|
+
const baseColor = color || theme.iconColor;
|
|
196
|
+
|
|
192
197
|
const textBadgeColor = getThemeValue(theme.mode, {
|
|
193
|
-
dark: a11yColor(getTextColor(
|
|
194
|
-
light: a11yColor(getTextColor(
|
|
195
|
-
light2: a11yColor(getTextColor(
|
|
198
|
+
dark: a11yColor(getTextColor(baseColor), getDarkenColor(baseColor), 12),
|
|
199
|
+
light: a11yColor(getTextColor(baseColor), getDarkenColor(baseColor), 12),
|
|
200
|
+
light2: a11yColor(getTextColor(baseColor), getDarkenColor(baseColor), 12),
|
|
196
201
|
});
|
|
197
202
|
|
|
198
203
|
const backgroundBadgeColor = getThemeValue(theme.mode, {
|
|
199
|
-
dark: getDarkenColor(
|
|
200
|
-
light:
|
|
201
|
-
light2:
|
|
204
|
+
dark: getDarkenColor(baseColor),
|
|
205
|
+
light: baseColor,
|
|
206
|
+
light2: baseColor,
|
|
202
207
|
});
|
|
203
208
|
|
|
204
209
|
const style = {
|
|
205
|
-
[colorProp]:
|
|
206
|
-
//[colorProp]:
|
|
210
|
+
[colorProp]: baseColor ? textBadgeColor : colors.inversedTextColor,
|
|
211
|
+
//[colorProp]: baseColor ? getTextColor(baseColor) : colors.inversedTextColor,
|
|
207
212
|
[colorBackgroundProp]: backgroundBadgeColor || colors.shades.opacity25,
|
|
208
|
-
//[colorBackgroundProp]:
|
|
213
|
+
//[colorBackgroundProp]: baseColor || colors.shades.opacity25,
|
|
209
214
|
[colorBorderProp]: backgroundBadgeColor,
|
|
210
|
-
[colorDarkProp]: getDarkenColor(
|
|
215
|
+
[colorDarkProp]: getDarkenColor(baseColor),
|
|
211
216
|
} as CSSProperties;
|
|
212
217
|
|
|
213
218
|
return (
|
|
@@ -225,6 +230,7 @@ export const TypeBadge = memo(
|
|
|
225
230
|
[selectedStyle]: selected,
|
|
226
231
|
[clickableStyle]: onClick,
|
|
227
232
|
[fadedStyle]: faded,
|
|
233
|
+
[noColorStyle]: color === null,
|
|
228
234
|
},
|
|
229
235
|
className
|
|
230
236
|
)}
|
|
@@ -265,6 +271,7 @@ type TypeObjectBadgeParams = {
|
|
|
265
271
|
selected?: boolean;
|
|
266
272
|
faded?: boolean;
|
|
267
273
|
tooltip?: boolean;
|
|
274
|
+
noColor?: boolean;
|
|
268
275
|
};
|
|
269
276
|
|
|
270
277
|
export const TypeObjectBadge = forwardRef<HTMLDivElement | HTMLButtonElement, TypeObjectBadgeParams>(
|
|
@@ -284,6 +291,7 @@ export const TypeObjectBadge = forwardRef<HTMLDivElement | HTMLButtonElement, Ty
|
|
|
284
291
|
selected,
|
|
285
292
|
faded,
|
|
286
293
|
tooltip = true,
|
|
294
|
+
noColor,
|
|
287
295
|
},
|
|
288
296
|
ref
|
|
289
297
|
) => {
|
|
@@ -293,7 +301,7 @@ export const TypeObjectBadge = forwardRef<HTMLDivElement | HTMLButtonElement, Ty
|
|
|
293
301
|
return (
|
|
294
302
|
<TypeBadge
|
|
295
303
|
ref={ref}
|
|
296
|
-
color={typeObject.color}
|
|
304
|
+
color={noColor ? null : typeObject.color}
|
|
297
305
|
abbr={abbr}
|
|
298
306
|
compact={compact}
|
|
299
307
|
vertical={vertical}
|
package/src/unit/primitive.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
invalidUnitClassName,
|
|
14
14
|
positionUnitClass,
|
|
15
15
|
regularSizeUnitClassName,
|
|
16
|
+
unitMinHeightClassName,
|
|
16
17
|
regularSizeUnitMinWidthClassName,
|
|
17
18
|
textEllipsisClassName,
|
|
18
19
|
unitDescriptionClassName,
|
|
@@ -75,6 +76,7 @@ export const UnitPrimitive = ({
|
|
|
75
76
|
shrinkable = true,
|
|
76
77
|
clickable = border,
|
|
77
78
|
setMinWidth = true,
|
|
79
|
+
setMinHeight = true,
|
|
78
80
|
// Callback
|
|
79
81
|
onClick,
|
|
80
82
|
onKeyDown,
|
|
@@ -90,6 +92,7 @@ export const UnitPrimitive = ({
|
|
|
90
92
|
basicUnitClassName,
|
|
91
93
|
big ? bigSizeUnitClassName : regularSizeUnitClassName,
|
|
92
94
|
setMinWidth && (big ? bigSizeUnitMinWidthClassName : regularSizeUnitMinWidthClassName),
|
|
95
|
+
setMinHeight && unitMinHeightClassName,
|
|
93
96
|
border && borderClassName,
|
|
94
97
|
invalid && invalidUnitClassName,
|
|
95
98
|
clickable && clickableClassName
|
package/src/unit/styles.ts
CHANGED
|
@@ -42,6 +42,10 @@ export const regularSizeUnitMinWidthClassName = css`
|
|
|
42
42
|
justify-content: center;
|
|
43
43
|
`;
|
|
44
44
|
|
|
45
|
+
export const unitMinHeightClassName = css`
|
|
46
|
+
min-height: ${space.s24}px;
|
|
47
|
+
`;
|
|
48
|
+
|
|
45
49
|
export const unitTitleClassName = css`
|
|
46
50
|
${textStyles.heading7}
|
|
47
51
|
padding-bottom: ${space.s2}px;
|
package/src/unit/types.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type UnitPrimitiveProps = {
|
|
|
23
23
|
shrinkable?: boolean;
|
|
24
24
|
clickable?: boolean;
|
|
25
25
|
setMinWidth?: boolean;
|
|
26
|
+
setMinHeight?: boolean;
|
|
26
27
|
// Callbacks
|
|
27
28
|
onKeyDown?: (e: KeyboardEvent<HTMLButtonElement | HTMLDivElement>) => void;
|
|
28
29
|
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|