@fibery/ui-kit 1.36.1 → 1.37.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/CHANGELOG.md +15 -0
- package/package.json +3 -3
- package/scripts/generate-icons.mjs +15 -1
- package/src/action-badge.tsx +5 -4
- package/src/actions-menu/actions-menu-confirmation.tsx +1 -12
- package/src/actions-menu/actions-menu-item.tsx +3 -3
- package/src/actions-menu/actions-menu-sub-command-menu.tsx +3 -0
- package/src/antd/ant-modal.tsx +17 -2
- package/src/antd/input.tsx +4 -3
- package/src/app-icon-with-fallback.tsx +5 -8
- package/src/app-icon-wrapper.tsx +4 -4
- package/src/appIcons.json +20 -0
- package/src/badge.tsx +14 -7
- package/src/beta-badge.tsx +21 -0
- package/src/button/actions-button-compact.tsx +1 -1
- package/src/button/base-button.tsx +4 -3
- package/src/button/button.tsx +89 -2
- package/src/button/icon-button.tsx +4 -2
- package/src/button/select-button.tsx +23 -8
- package/src/card-container.tsx +29 -65
- package/src/card-hidden-link.tsx +52 -0
- package/src/collapsible-section.tsx +13 -3
- package/src/color-picker/index.js +65 -60
- package/src/color-picker/swatch.tsx +28 -14
- package/src/command-menu/index.tsx +16 -11
- package/src/command-menu/nested-command-menu.tsx +8 -1
- package/src/context-menu/index.tsx +3 -3
- package/src/count-badge.tsx +57 -0
- package/src/date-picker/date-range-input.tsx +1 -1
- package/src/date-picker/fake-date-input.tsx +1 -1
- package/src/date-picker/relative-date-picker.tsx +1 -1
- package/src/date-picker/single-date-input.tsx +1 -1
- package/src/date-picker/utils.ts +9 -2
- package/src/design-system.ts +85 -50
- package/src/dropdown-menu/index.tsx +1 -1
- package/src/emoji-picker/emoji-picker-content-with-color.tsx +3 -9
- package/src/emoji-picker/icon-emoji-picker.tsx +75 -69
- package/src/emoji-picker/primitives/header.tsx +1 -0
- package/src/emoji-picker/primitives/search.tsx +12 -13
- package/src/error-alert/error-alert.tsx +19 -7
- package/src/field-app-icon.tsx +29 -0
- package/src/field-container.tsx +4 -2
- package/src/field-icon.tsx +26 -0
- package/src/field-type-icon.tsx +82 -0
- package/src/format-date-from-now.ts +1 -1
- package/src/guide-link.tsx +4 -3
- package/src/hint.tsx +10 -1
- package/src/html-styles.ts +15 -13
- package/src/icons/ast/AiFiberyBuild.ts +8 -0
- package/src/icons/ast/Anthropic.ts +8 -0
- package/src/icons/ast/Apple.ts +8 -0
- package/src/icons/ast/ArrowBottom.ts +1 -1
- package/src/icons/ast/ArrowForward.ts +1 -1
- package/src/icons/ast/ArrowLeft.ts +1 -1
- package/src/icons/ast/ArrowRight.ts +1 -1
- package/src/icons/ast/ArrowTop.ts +1 -1
- package/src/icons/ast/Crosshair.ts +8 -0
- package/src/icons/ast/Csv.ts +8 -0
- package/src/icons/ast/Document.ts +8 -0
- package/src/icons/ast/EntityCreate.ts +8 -0
- package/src/icons/ast/ExpandAll.ts +8 -0
- package/src/icons/ast/FiberyDesktopApp.ts +8 -0
- package/src/icons/ast/FiberyMono.ts +1 -1
- package/src/icons/ast/FileDownload.ts +8 -0
- package/src/icons/ast/GraduationCapFilled.ts +8 -0
- package/src/icons/ast/Home.ts +1 -1
- package/src/icons/ast/ImportFilled.ts +8 -0
- package/src/icons/ast/IntegrationsFilled.ts +8 -0
- package/src/icons/ast/LocationEdit.ts +8 -0
- package/src/icons/ast/MessagePlus.ts +8 -0
- package/src/icons/ast/OpenAi.ts +8 -0
- package/src/icons/ast/RicheditorMarkHighlight.ts +8 -0
- package/src/icons/ast/RicheditorMarkStrike.ts +1 -1
- package/src/icons/ast/RicheditorMarkUnderline.ts +1 -1
- package/src/icons/ast/SpaceApp.ts +8 -0
- package/src/icons/ast/SpaceGenerate.ts +8 -0
- package/src/icons/ast/SpaceList.ts +8 -0
- package/src/icons/ast/SpaceScratch.ts +8 -0
- package/src/icons/ast/SpaceTemplate.ts +8 -0
- package/src/icons/ast/SuggestIntegration.ts +8 -0
- package/src/icons/ast/TableLayout.ts +8 -0
- package/src/icons/ast/TemplatesFilled.ts +8 -0
- package/src/icons/ast/ThumbsDown.ts +8 -0
- package/src/icons/ast/ThumbsUp.ts +8 -0
- package/src/icons/ast/ViewDashboard.ts +8 -0
- package/src/icons/ast/WarningTriangleFilled.ts +8 -0
- package/src/icons/ast/Windows.ts +8 -0
- package/src/icons/ast/index.tsx +30 -0
- package/src/icons/react/AiFiberyBuild.tsx +13 -0
- package/src/icons/react/Anthropic.tsx +13 -0
- package/src/icons/react/Apple.tsx +13 -0
- package/src/icons/react/Crosshair.tsx +13 -0
- package/src/icons/react/Csv.tsx +13 -0
- package/src/icons/react/Document.tsx +13 -0
- package/src/icons/react/EntityCreate.tsx +13 -0
- package/src/icons/react/ExpandAll.tsx +13 -0
- package/src/icons/react/FiberyDesktopApp.tsx +13 -0
- package/src/icons/react/FileDownload.tsx +13 -0
- package/src/icons/react/GraduationCapFilled.tsx +13 -0
- package/src/icons/react/ImportFilled.tsx +13 -0
- package/src/icons/react/IntegrationsFilled.tsx +13 -0
- package/src/icons/react/LocationEdit.tsx +13 -0
- package/src/icons/react/MessagePlus.tsx +13 -0
- package/src/icons/react/OpenAi.tsx +13 -0
- package/src/icons/react/RicheditorMarkHighlight.tsx +13 -0
- package/src/icons/react/SpaceApp.tsx +13 -0
- package/src/icons/react/SpaceGenerate.tsx +13 -0
- package/src/icons/react/SpaceList.tsx +13 -0
- package/src/icons/react/SpaceScratch.tsx +13 -0
- package/src/icons/react/SpaceTemplate.tsx +13 -0
- package/src/icons/react/SuggestIntegration.tsx +13 -0
- package/src/icons/react/TableLayout.tsx +13 -0
- package/src/icons/react/TemplatesFilled.tsx +13 -0
- package/src/icons/react/ThumbsDown.tsx +13 -0
- package/src/icons/react/ThumbsUp.tsx +13 -0
- package/src/icons/react/ViewDashboard.tsx +13 -0
- package/src/icons/react/WarningTriangleFilled.tsx +13 -0
- package/src/icons/react/Windows.tsx +13 -0
- package/src/icons/react/index.tsx +30 -0
- package/src/icons/svg/ai-fibery-build.svg +24 -0
- package/src/icons/svg/anthropic.svg +3 -0
- package/src/icons/svg/apple.svg +4 -0
- package/src/icons/svg/arrow-bottom.svg +1 -1
- package/src/icons/svg/arrow-forward.svg +1 -1
- package/src/icons/svg/arrow-left.svg +1 -1
- package/src/icons/svg/arrow-right.svg +1 -1
- package/src/icons/svg/arrow-top.svg +1 -1
- package/src/icons/svg/crosshair.svg +4 -0
- package/src/icons/svg/csv.svg +3 -0
- package/src/icons/svg/document.svg +4 -0
- package/src/icons/svg/entity-create.svg +3 -0
- package/src/icons/svg/expand-all.svg +3 -0
- package/src/icons/svg/fibery-desktop-app.svg +101 -0
- package/src/icons/svg/fibery-mono.svg +6 -1
- package/src/icons/svg/file-download.svg +4 -0
- package/src/icons/svg/go-to.svg +1 -3
- package/src/icons/svg/graduation-cap-filled.svg +4 -0
- package/src/icons/svg/home.svg +4 -2
- package/src/icons/svg/import-filled.svg +4 -0
- package/src/icons/svg/integrations-filled.svg +4 -0
- package/src/icons/svg/location-edit.svg +13 -0
- package/src/icons/svg/message-plus.svg +4 -0
- package/src/icons/svg/open-ai.svg +3 -0
- package/src/icons/svg/open-as-page.svg +2 -3
- package/src/icons/svg/richeditor/mark/code.svg +4 -5
- package/src/icons/svg/richeditor/mark/em.svg +3 -2
- package/src/icons/svg/richeditor/mark/highlight.svg +3 -0
- package/src/icons/svg/richeditor/mark/strike.svg +3 -2
- package/src/icons/svg/richeditor/mark/strong.svg +3 -2
- package/src/icons/svg/richeditor/mark/underline.svg +4 -2
- package/src/icons/svg/space-app.svg +3 -0
- package/src/icons/svg/space-generate.svg +3 -0
- package/src/icons/svg/space-list.svg +4 -0
- package/src/icons/svg/space-scratch.svg +3 -0
- package/src/icons/svg/space-template.svg +3 -0
- package/src/icons/svg/suggest-integration.svg +4 -0
- package/src/icons/svg/table-layout.svg +3 -0
- package/src/icons/svg/templates-filled.svg +6 -0
- package/src/icons/svg/thumbs-down.svg +3 -0
- package/src/icons/svg/thumbs-up.svg +3 -0
- package/src/icons/svg/view-dashboard.svg +5 -0
- package/src/icons/svg/warning-triangle-filled.svg +3 -0
- package/src/icons/svg/windows.svg +15 -0
- package/src/icons/types.ts +2 -2
- package/src/integration-compact-info-button.tsx +3 -1
- package/src/layout-styles.ts +23 -0
- package/src/lists/list-row-surface.tsx +2 -1
- package/src/loaders.tsx +6 -6
- package/src/logo.tsx +23 -48
- package/src/mobile-styles.ts +2 -0
- package/src/new-badge.tsx +5 -6
- package/src/number-input/text-area-auto-sized.tsx +47 -0
- package/src/number-input/text-input-auto-sized.tsx +49 -0
- package/src/palette.ts +50 -50
- package/src/popup/index.tsx +1 -0
- package/src/rich-text-embed-error.tsx +2 -2
- package/src/select/{custom-select-partials → components}/menu.tsx +13 -7
- package/src/select/{custom-select-partials → components}/no-option-message.tsx +0 -1
- package/src/select/constants.ts +1 -0
- package/src/select/index.tsx +136 -145
- package/src/select/select-in-popover.tsx +103 -108
- package/src/select/styles.ts +60 -24
- package/src/shortcut-badge.tsx +1 -0
- package/src/tab-nav/tab-nav.tsx +12 -19
- package/src/theme-provider.tsx +9 -1
- package/src/toast/utils/toastify-item-name.ts +1 -1
- package/src/tooltip-if-overflown.tsx +9 -3
- package/src/type-badge-box.tsx +4 -2
- package/src/type-badge.tsx +20 -12
- package/src/unit/index.tsx +9 -1
- package/src/unit/loading-unit-value.tsx +1 -0
- package/src/unit/maybe-unit-value.tsx +3 -3
- package/src/unit/primitive.tsx +60 -41
- package/src/unit/styles.ts +12 -12
- package/src/unit/types.ts +5 -2
- package/src/unit/unit-button-group.tsx +6 -11
- package/src/unit/unit-content.tsx +13 -5
- package/src/unit/unit-with-title.tsx +6 -1
- package/src/unit/unit-with-tooltip.tsx +24 -9
- package/src/use-is-phone.tsx +12 -0
- package/src/workflow-progress-icon.tsx +1 -1
- package/src/number-input/text-area-with-autosize.tsx +0 -91
- package/src/number-input/text-inline-input-with-autosize.tsx +0 -60
- package/src/use-is-phone.ts +0 -5
- /package/src/select/{custom-select-partials → components}/clear-indicator.tsx +0 -0
- /package/src/select/{custom-select-partials → components}/drop-down-indicator.tsx +0 -0
- /package/src/select/{custom-select-partials → components}/group-heading.tsx +0 -0
- /package/src/select/{custom-select-partials → components}/menu-list-virtualized.tsx +0 -0
- /package/src/select/{custom-select-partials → components}/option.tsx +0 -0
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/index.tsx
CHANGED
|
@@ -51,5 +51,13 @@ export const OptionUnit = (props: UnitPrimitiveProps) => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
export const HistoryUnit = (props: UnitPrimitiveProps & {size: CardSize}) => {
|
|
54
|
-
return
|
|
54
|
+
return (
|
|
55
|
+
<UnitPrimitive
|
|
56
|
+
big={props.size === ":card-size/cell"}
|
|
57
|
+
bgColor={themeVars.unitBg}
|
|
58
|
+
border={false}
|
|
59
|
+
tooltip={false}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
55
63
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {LoadingUnitValue} from "./loading-unit-value";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
value?: string;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
|
|
7
|
-
export const MaybeUnitValue: React.FC<
|
|
7
|
+
export const MaybeUnitValue: React.FC<Props> = ({value}) => {
|
|
8
8
|
return value === undefined ? <LoadingUnitValue minWidth={18} maxWidth={18} /> : <>{value}</>;
|
|
9
9
|
};
|
package/src/unit/primitive.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import {css} from "@linaria/core";
|
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import {ComponentProps} from "react";
|
|
4
4
|
import {inputOverrides} from "../antd/styles";
|
|
5
|
-
import {border, themeVars} from "../design-system";
|
|
5
|
+
import {border, space, themeVars} from "../design-system";
|
|
6
6
|
import {
|
|
7
7
|
basicUnitClassName,
|
|
8
8
|
bigSizeUnitClassName,
|
|
@@ -14,16 +14,17 @@ import {
|
|
|
14
14
|
positionUnitClass,
|
|
15
15
|
regularSizeUnitClassName,
|
|
16
16
|
regularSizeUnitMinWidthClassName,
|
|
17
|
-
textEllipsisClassName,
|
|
18
17
|
unitDescriptionClassName,
|
|
18
|
+
unitMinHeightClassName,
|
|
19
19
|
unitTitleClassName,
|
|
20
|
-
unitTooltipTitleClassName,
|
|
21
20
|
unitWithTitleClassName,
|
|
22
21
|
} from "./styles";
|
|
23
22
|
import {UnitPrimitiveProps} from "./types";
|
|
24
23
|
import {UnitButtonGroup} from "./unit-button-group";
|
|
25
24
|
import {UnitContent} from "./unit-content";
|
|
26
25
|
import {UnitWithTooltip} from "./unit-with-tooltip";
|
|
26
|
+
import {FieldIcon} from "../field-icon";
|
|
27
|
+
import {useTruncated} from "../tooltip-if-overflown";
|
|
27
28
|
|
|
28
29
|
const resetButtonStylesClassName = css`
|
|
29
30
|
all: unset;
|
|
@@ -62,6 +63,7 @@ export const UnitPrimitive = ({
|
|
|
62
63
|
// Content
|
|
63
64
|
children,
|
|
64
65
|
title,
|
|
66
|
+
fieldIcon,
|
|
65
67
|
description = null,
|
|
66
68
|
hint = null,
|
|
67
69
|
icons,
|
|
@@ -71,25 +73,32 @@ export const UnitPrimitive = ({
|
|
|
71
73
|
tooltip = true,
|
|
72
74
|
header = false,
|
|
73
75
|
border = true,
|
|
76
|
+
color = themeVars.textColor,
|
|
74
77
|
bgColor = themeVars.transparent,
|
|
78
|
+
fontWeight,
|
|
75
79
|
shrinkable = true,
|
|
76
80
|
clickable = border,
|
|
77
81
|
setMinWidth = true,
|
|
82
|
+
setMinHeight = true,
|
|
78
83
|
// Callback
|
|
79
84
|
onClick,
|
|
80
85
|
onKeyDown,
|
|
81
86
|
invalid,
|
|
82
|
-
tooltipContent: tooltipChildren,
|
|
83
87
|
}: UnitPrimitiveProps) => {
|
|
84
|
-
const
|
|
88
|
+
const {truncated, setNode} = useTruncated();
|
|
89
|
+
|
|
90
|
+
const truncate = !multiline && overflow;
|
|
85
91
|
const unitWrapperStyle = {
|
|
92
|
+
color,
|
|
86
93
|
backgroundColor: bgColor || themeVars.inputDisabledBgColor,
|
|
94
|
+
fontWeight,
|
|
87
95
|
};
|
|
88
96
|
|
|
89
97
|
const unitWrapperClassName = cx(
|
|
90
98
|
basicUnitClassName,
|
|
91
99
|
big ? bigSizeUnitClassName : regularSizeUnitClassName,
|
|
92
100
|
setMinWidth && (big ? bigSizeUnitMinWidthClassName : regularSizeUnitMinWidthClassName),
|
|
101
|
+
setMinHeight && unitMinHeightClassName,
|
|
93
102
|
border && borderClassName,
|
|
94
103
|
invalid && invalidUnitClassName,
|
|
95
104
|
clickable && clickableClassName
|
|
@@ -103,22 +112,18 @@ export const UnitPrimitive = ({
|
|
|
103
112
|
inline={inline}
|
|
104
113
|
style={unitWrapperStyle}
|
|
105
114
|
className={unitWrapperClassName}
|
|
106
|
-
|
|
115
|
+
unit={
|
|
107
116
|
<UnitContentComponent onKeyDown={onKeyDown} onClick={onClick}>
|
|
108
|
-
<UnitContent
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
children={children}
|
|
112
|
-
contentClassName={cx({[textEllipsisClassName]: cutTextInUnit})}
|
|
113
|
-
shrinkable={shrinkable}
|
|
114
|
-
/>
|
|
117
|
+
<UnitContent big={big} icons={icons} shrinkable={shrinkable} truncate={truncate} setNode={setNode}>
|
|
118
|
+
{children}
|
|
119
|
+
</UnitContent>
|
|
115
120
|
</UnitContentComponent>
|
|
116
121
|
}
|
|
117
122
|
navButton={navButton}
|
|
118
123
|
/>
|
|
119
124
|
);
|
|
120
125
|
|
|
121
|
-
const
|
|
126
|
+
const contentWithHeader = header ? (
|
|
122
127
|
<div className={unitWithTitleClassName}>
|
|
123
128
|
<div className={unitTitleClassName}>{title}</div>
|
|
124
129
|
{content}
|
|
@@ -127,41 +132,55 @@ export const UnitPrimitive = ({
|
|
|
127
132
|
content
|
|
128
133
|
);
|
|
129
134
|
|
|
130
|
-
if (tooltip) {
|
|
131
|
-
|
|
135
|
+
if (!tooltip) {
|
|
136
|
+
return <div className={positionUnitClass}>{contentWithHeader}</div>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const tooltipTitle = (
|
|
140
|
+
<div
|
|
141
|
+
className={css`
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
gap: ${space.s4}px;
|
|
145
|
+
`}
|
|
146
|
+
>
|
|
147
|
+
{fieldIcon && <FieldIcon iconName={fieldIcon} iconSize={14} color={themeVars.whiteColor} />}
|
|
148
|
+
{title}
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const tooltipContent = truncated && (
|
|
153
|
+
<div className={fullUnitWrapperClassName}>
|
|
132
154
|
<UnitButtonGroup
|
|
133
155
|
big={big}
|
|
134
156
|
inline={inline}
|
|
135
157
|
style={unitWrapperStyle}
|
|
136
158
|
className={unitWrapperClassName}
|
|
137
|
-
|
|
138
|
-
<UnitContentComponent
|
|
159
|
+
unit={
|
|
160
|
+
<UnitContentComponent>
|
|
139
161
|
<UnitContent big={big} icons={icons}>
|
|
140
|
-
{
|
|
162
|
+
{children}
|
|
141
163
|
</UnitContent>
|
|
142
164
|
</UnitContentComponent>
|
|
143
165
|
}
|
|
144
166
|
/>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
} else {
|
|
165
|
-
return <div className={positionUnitClass}>{contentWithTitle}</div>;
|
|
166
|
-
}
|
|
167
|
+
</div>
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const hasDescription = description || tooltipContent || hint;
|
|
171
|
+
const tooltipDescription = hasDescription && (
|
|
172
|
+
<div>
|
|
173
|
+
{description && <div className={unitDescriptionClassName}>{description}</div>}
|
|
174
|
+
{tooltipContent}
|
|
175
|
+
{hint}
|
|
176
|
+
</div>
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<div className={positionUnitClass}>
|
|
181
|
+
<UnitWithTooltip title={tooltipTitle} description={tooltipDescription}>
|
|
182
|
+
{contentWithHeader}
|
|
183
|
+
</UnitWithTooltip>
|
|
184
|
+
</div>
|
|
185
|
+
);
|
|
167
186
|
};
|
package/src/unit/styles.ts
CHANGED
|
@@ -42,16 +42,16 @@ 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;
|
|
48
52
|
padding-top: ${space.s6}px;
|
|
49
53
|
`;
|
|
50
54
|
|
|
51
|
-
export const unitTooltipTitleClassName = css`
|
|
52
|
-
margin-bottom: ${space.s4}px;
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
55
|
export const unitWithTitleClassName = css`
|
|
56
56
|
display: flex;
|
|
57
57
|
flex-direction: column;
|
|
@@ -64,6 +64,10 @@ export const unitWithTitleClassName = css`
|
|
|
64
64
|
export const invalidUnitClassName = css``;
|
|
65
65
|
export const invalidUnitClassNameInForm = css``;
|
|
66
66
|
|
|
67
|
+
export const clickableClassName = css`
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
`;
|
|
70
|
+
|
|
67
71
|
export const borderClassName = css`
|
|
68
72
|
position: relative;
|
|
69
73
|
|
|
@@ -84,11 +88,11 @@ export const borderClassName = css`
|
|
|
84
88
|
pointer-events: none;
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
|
|
91
|
+
&.${clickableClassName}:hover::before {
|
|
88
92
|
box-shadow: ${themeVars.inputBorderHoverColor} inset;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
|
|
95
|
+
&.${clickableClassName}:focus::before {
|
|
92
96
|
box-shadow: ${themeVars.inputBorderFocusColor} inset;
|
|
93
97
|
}
|
|
94
98
|
|
|
@@ -106,12 +110,12 @@ export const borderClassName = css`
|
|
|
106
110
|
border: 1px solid ${themeVars.colorBorderButtonOutlineAccentDefault};
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
|
|
113
|
+
&.${clickableClassName}:hover::before {
|
|
110
114
|
box-shadow: none;
|
|
111
115
|
border: 1px solid ${themeVars.colorBorderReactionsSelectedHover};
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
|
|
118
|
+
&.${clickableClassName}:focus::before {
|
|
115
119
|
box-shadow: ${themeVars.inputBorderFocusColor} inset;
|
|
116
120
|
border: none;
|
|
117
121
|
}
|
|
@@ -132,10 +136,6 @@ export const borderClassName = css`
|
|
|
132
136
|
}
|
|
133
137
|
`;
|
|
134
138
|
|
|
135
|
-
export const clickableClassName = css`
|
|
136
|
-
cursor: pointer;
|
|
137
|
-
`;
|
|
138
|
-
|
|
139
139
|
export const basicUnitContentClassName = css`
|
|
140
140
|
padding-left: ${space.s4}px;
|
|
141
141
|
padding-right: ${space.s4}px;
|
package/src/unit/types.ts
CHANGED
|
@@ -10,6 +10,7 @@ export type UnitPrimitiveProps = {
|
|
|
10
10
|
// Content
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
title?: string;
|
|
13
|
+
fieldIcon?: string;
|
|
13
14
|
description?: ReactNode;
|
|
14
15
|
icons?: React.ReactNodeArray;
|
|
15
16
|
hint?: ReactNode;
|
|
@@ -19,13 +20,15 @@ export type UnitPrimitiveProps = {
|
|
|
19
20
|
tooltip?: boolean;
|
|
20
21
|
header?: boolean;
|
|
21
22
|
border?: boolean;
|
|
22
|
-
|
|
23
|
+
color?: string;
|
|
24
|
+
bgColor?: string | null;
|
|
25
|
+
fontWeight?: number;
|
|
23
26
|
shrinkable?: boolean;
|
|
24
27
|
clickable?: boolean;
|
|
25
28
|
setMinWidth?: boolean;
|
|
29
|
+
setMinHeight?: boolean;
|
|
26
30
|
// Callbacks
|
|
27
31
|
onKeyDown?: (e: KeyboardEvent<HTMLButtonElement | HTMLDivElement>) => void;
|
|
28
32
|
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
29
33
|
invalid?: boolean;
|
|
30
|
-
tooltipContent?: ReactNode;
|
|
31
34
|
};
|
|
@@ -3,21 +3,16 @@ import {space} from "../design-system";
|
|
|
3
3
|
import {IconButtonProps} from "../button/icon-button";
|
|
4
4
|
import {getHeight} from "./unit-content-layout";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
big,
|
|
8
|
-
inline,
|
|
9
|
-
style,
|
|
10
|
-
className,
|
|
11
|
-
unitButton,
|
|
12
|
-
navButton,
|
|
13
|
-
}: {
|
|
6
|
+
type Props = {
|
|
14
7
|
big: boolean;
|
|
15
8
|
inline: boolean;
|
|
16
9
|
style: React.CSSProperties;
|
|
17
10
|
className: string;
|
|
18
|
-
|
|
11
|
+
unit?: ReactNode;
|
|
19
12
|
navButton?: ReactNode;
|
|
20
|
-
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const UnitButtonGroup = ({big, inline, style, className, unit, navButton}: Props) => {
|
|
21
16
|
const navButtonNode = navButton && (Children.only(navButton) as React.ReactElement<IconButtonProps>);
|
|
22
17
|
const navButtonSize = getHeight(big) + 2 * space.s2;
|
|
23
18
|
return (
|
|
@@ -28,7 +23,7 @@ export const UnitButtonGroup = ({
|
|
|
28
23
|
}}
|
|
29
24
|
className={className}
|
|
30
25
|
>
|
|
31
|
-
{
|
|
26
|
+
{unit}
|
|
32
27
|
{navButtonNode &&
|
|
33
28
|
cloneElement(navButtonNode, {
|
|
34
29
|
style: {...navButtonNode.props.style, width: navButtonSize, height: navButtonSize},
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
alignCenterClassName,
|
|
3
|
+
basicUnitContentClassName,
|
|
4
|
+
textEllipsisClassName,
|
|
5
|
+
unitContentContainerClassName,
|
|
6
|
+
} from "./styles";
|
|
2
7
|
import {ReactNode} from "react";
|
|
3
8
|
import {cx} from "@linaria/core";
|
|
4
9
|
import {UnitContentLayout} from "./unit-content-layout";
|
|
@@ -6,12 +11,13 @@ import {UnitContentLayout} from "./unit-content-layout";
|
|
|
6
11
|
type Props = {
|
|
7
12
|
big: boolean;
|
|
8
13
|
icons?: React.ReactNodeArray;
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
contentClassName?: string;
|
|
11
14
|
shrinkable?: boolean;
|
|
15
|
+
truncate?: boolean;
|
|
16
|
+
setNode?: (element: HTMLElement | null) => void;
|
|
17
|
+
children?: ReactNode;
|
|
12
18
|
};
|
|
13
19
|
|
|
14
|
-
export const UnitContent = ({big, icons,
|
|
20
|
+
export const UnitContent = ({big, icons, shrinkable, truncate, setNode, children}: Props) => {
|
|
15
21
|
return (
|
|
16
22
|
<UnitContentLayout
|
|
17
23
|
big={big}
|
|
@@ -29,7 +35,9 @@ export const UnitContent = ({big, icons, children, contentClassName, shrinkable}
|
|
|
29
35
|
|
|
30
36
|
{children && (
|
|
31
37
|
<div className={unitContentContainerClassName}>
|
|
32
|
-
<div className={cx(basicUnitContentClassName,
|
|
38
|
+
<div ref={setNode} className={cx(basicUnitContentClassName, truncate && textEllipsisClassName)}>
|
|
39
|
+
{children}
|
|
40
|
+
</div>
|
|
33
41
|
</div>
|
|
34
42
|
)}
|
|
35
43
|
</UnitContentLayout>
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {unitTitleClassName, unitWithTitleClassName} from "./styles";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
children: React.ReactElement;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const UnitWithTitle = ({children, title}: Props) => (
|
|
4
9
|
<div className={unitWithTitleClassName}>
|
|
5
10
|
<div className={unitTitleClassName}>{title}</div>
|
|
6
11
|
{children}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {tooltipDelay} from "../../src/design-system";
|
|
2
|
-
import {Tooltip} from "../tooltip";
|
|
1
|
+
import {space, tooltipDelay} from "../../src/design-system";
|
|
2
|
+
import {Tooltip, TooltipDescription, TooltipTitle} from "../tooltip";
|
|
3
3
|
import {useRef, useState} from "react";
|
|
4
|
+
import {css} from "@linaria/core";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const contentCss = css`
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: ${space.s4}px;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
10
13
|
children: React.ReactElement;
|
|
11
14
|
title: React.ReactNode;
|
|
12
15
|
description: React.ReactNode;
|
|
13
|
-
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const UnitWithTooltip = ({children, title, description}: Props) => {
|
|
14
19
|
const [shouldDisplayTooltip, setShouldDisplayTooltip] = useState(false);
|
|
15
20
|
const unitElementRef = useRef<HTMLDivElement>(null);
|
|
16
21
|
const isHoveredRef = useRef(false);
|
|
@@ -51,7 +56,17 @@ export const UnitWithTooltip = ({
|
|
|
51
56
|
};
|
|
52
57
|
|
|
53
58
|
return (
|
|
54
|
-
<Tooltip
|
|
59
|
+
<Tooltip
|
|
60
|
+
visible={shouldDisplayTooltip}
|
|
61
|
+
content={
|
|
62
|
+
<div className={contentCss}>
|
|
63
|
+
<TooltipTitle>{title}</TooltipTitle>
|
|
64
|
+
{description && <TooltipDescription>{description}</TooltipDescription>}
|
|
65
|
+
</div>
|
|
66
|
+
}
|
|
67
|
+
side="bottom"
|
|
68
|
+
align="start"
|
|
69
|
+
>
|
|
55
70
|
<div ref={unitElementRef} onMouseDown={onMouseLeave} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
|
|
56
71
|
{children}
|
|
57
72
|
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {useIsMediaQueryMatched} from "./use-is-media-query-matched";
|
|
2
|
+
import {createContext} from "@fibery/react/src/create-context";
|
|
3
|
+
import {ReactNode} from "react";
|
|
4
|
+
|
|
5
|
+
const [Provider, useIsPhone] = createContext<boolean>("PhoneContext", false);
|
|
6
|
+
|
|
7
|
+
export {useIsPhone};
|
|
8
|
+
|
|
9
|
+
export function IsPhoneProvider({children}: {children: ReactNode}) {
|
|
10
|
+
const isPhone = useIsMediaQueryMatched("(max-width: 440px), (max-height: 440px)");
|
|
11
|
+
return <Provider value={isPhone}>{children}</Provider>;
|
|
12
|
+
}
|
|
@@ -22,7 +22,7 @@ export const WorkflowProgressIcon: FC<WorkflowProgressIcon> = ({
|
|
|
22
22
|
fillProgress = themeVars.progressIconFill,
|
|
23
23
|
fillBackground = themeVars.progressIconBg,
|
|
24
24
|
isDone,
|
|
25
|
-
doneStrokeColor = themeVars.
|
|
25
|
+
doneStrokeColor = themeVars.pageContentBg,
|
|
26
26
|
doneFillColor = themeVars.progressIconFill,
|
|
27
27
|
}) => {
|
|
28
28
|
return (
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {CSSProperties, useCallback, useRef} from "react";
|
|
2
|
-
import {stopPropagation} from "@fibery/react/src/stop-propagation";
|
|
3
|
-
import {hiddenCss, inputCss, textAreaCss} from "./styles";
|
|
4
|
-
import {css, cx} from "@linaria/core";
|
|
5
|
-
import {Stack} from "./stack";
|
|
6
|
-
import {invalidInputClass} from "./edit-unit-styles";
|
|
7
|
-
|
|
8
|
-
export const TextAreaWithAutosize = ({
|
|
9
|
-
value,
|
|
10
|
-
onFocus,
|
|
11
|
-
onBlur,
|
|
12
|
-
onChange,
|
|
13
|
-
onKeyDown,
|
|
14
|
-
autoFocus,
|
|
15
|
-
placeholder,
|
|
16
|
-
invalid,
|
|
17
|
-
...rest
|
|
18
|
-
}: {
|
|
19
|
-
value: string | null;
|
|
20
|
-
onFocus?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
21
|
-
onBlur?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
|
22
|
-
onKeyDown?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
23
|
-
onChange: (value: string | number) => void;
|
|
24
|
-
placeholder: string;
|
|
25
|
-
autoFocus: boolean;
|
|
26
|
-
style?: CSSProperties;
|
|
27
|
-
width?: number;
|
|
28
|
-
invalid?: boolean;
|
|
29
|
-
}) => {
|
|
30
|
-
const handleFocus: React.FocusEventHandler<HTMLTextAreaElement> = useCallback(
|
|
31
|
-
(e) => {
|
|
32
|
-
if (onFocus) {
|
|
33
|
-
onFocus(e);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
[onFocus]
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
40
|
-
const initialValue = useRef(value);
|
|
41
|
-
|
|
42
|
-
const handleBlur: React.FocusEventHandler<HTMLTextAreaElement> = useCallback(
|
|
43
|
-
(e) => {
|
|
44
|
-
if (onBlur) {
|
|
45
|
-
onBlur(e);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
[onBlur]
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const handleChange: React.ChangeEventHandler<HTMLTextAreaElement> = useCallback(
|
|
52
|
-
(e) => {
|
|
53
|
-
if (onChange) {
|
|
54
|
-
onChange(e.target.value);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
[onChange]
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<Stack
|
|
62
|
-
className={css`
|
|
63
|
-
width: 100%;
|
|
64
|
-
`}
|
|
65
|
-
bottom={
|
|
66
|
-
<div className={cx(inputCss, textAreaCss, hiddenCss)}>
|
|
67
|
-
{value === null || value === "" || initialValue.current === null || initialValue.current === ""
|
|
68
|
-
? placeholder
|
|
69
|
-
: value}
|
|
70
|
-
</div>
|
|
71
|
-
}
|
|
72
|
-
top={
|
|
73
|
-
<textarea
|
|
74
|
-
// Allow textarea to shrink to 1 row if there is only 1 row (otherwise it has min 2 by default)
|
|
75
|
-
rows={1}
|
|
76
|
-
autoFocus={autoFocus}
|
|
77
|
-
ref={inputRef}
|
|
78
|
-
value={value || ""}
|
|
79
|
-
onFocus={handleFocus}
|
|
80
|
-
onBlur={handleBlur}
|
|
81
|
-
onChange={handleChange}
|
|
82
|
-
onKeyDown={onKeyDown}
|
|
83
|
-
placeholder={placeholder}
|
|
84
|
-
onClick={stopPropagation}
|
|
85
|
-
{...rest}
|
|
86
|
-
className={cx(inputCss, textAreaCss, invalid && invalidInputClass)}
|
|
87
|
-
/>
|
|
88
|
-
}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
};
|