@fibery/ui-kit 1.36.2 → 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 +6 -0
- package/package.json +1 -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 +1 -1
- 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 +12 -8
- package/src/button/actions-button-compact.tsx +1 -1
- package/src/button/base-button.tsx +2 -1
- 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 +2 -2
- 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 +72 -41
- 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/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 +1 -1
- 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/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/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 +1 -1
- 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/SpaceScratch.ts +8 -0
- package/src/icons/ast/SpaceTemplate.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 +25 -0
- package/src/icons/react/AiFiberyBuild.tsx +13 -0
- package/src/icons/react/Apple.tsx +13 -0
- package/src/icons/react/Crosshair.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/RicheditorMarkHighlight.tsx +13 -0
- package/src/icons/react/SpaceApp.tsx +13 -0
- package/src/icons/react/SpaceGenerate.tsx +13 -0
- package/src/icons/react/SpaceScratch.tsx +13 -0
- package/src/icons/react/SpaceTemplate.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 +25 -0
- package/src/icons/svg/ai-fibery-build.svg +24 -0
- package/src/icons/svg/anthropic.svg +2 -14
- 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/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/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 +2 -7
- 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-scratch.svg +3 -0
- package/src/icons/svg/space-template.svg +3 -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/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 +16 -9
- package/src/mobile-styles.ts +2 -0
- package/src/new-badge.tsx +4 -7
- 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 +101 -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/tooltip-if-overflown.tsx +9 -3
- 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 +58 -42
- package/src/unit/styles.ts +8 -12
- package/src/unit/types.ts +4 -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/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,
|
|
@@ -13,18 +13,18 @@ import {
|
|
|
13
13
|
invalidUnitClassName,
|
|
14
14
|
positionUnitClass,
|
|
15
15
|
regularSizeUnitClassName,
|
|
16
|
-
unitMinHeightClassName,
|
|
17
16
|
regularSizeUnitMinWidthClassName,
|
|
18
|
-
textEllipsisClassName,
|
|
19
17
|
unitDescriptionClassName,
|
|
18
|
+
unitMinHeightClassName,
|
|
20
19
|
unitTitleClassName,
|
|
21
|
-
unitTooltipTitleClassName,
|
|
22
20
|
unitWithTitleClassName,
|
|
23
21
|
} from "./styles";
|
|
24
22
|
import {UnitPrimitiveProps} from "./types";
|
|
25
23
|
import {UnitButtonGroup} from "./unit-button-group";
|
|
26
24
|
import {UnitContent} from "./unit-content";
|
|
27
25
|
import {UnitWithTooltip} from "./unit-with-tooltip";
|
|
26
|
+
import {FieldIcon} from "../field-icon";
|
|
27
|
+
import {useTruncated} from "../tooltip-if-overflown";
|
|
28
28
|
|
|
29
29
|
const resetButtonStylesClassName = css`
|
|
30
30
|
all: unset;
|
|
@@ -63,6 +63,7 @@ export const UnitPrimitive = ({
|
|
|
63
63
|
// Content
|
|
64
64
|
children,
|
|
65
65
|
title,
|
|
66
|
+
fieldIcon,
|
|
66
67
|
description = null,
|
|
67
68
|
hint = null,
|
|
68
69
|
icons,
|
|
@@ -72,7 +73,9 @@ export const UnitPrimitive = ({
|
|
|
72
73
|
tooltip = true,
|
|
73
74
|
header = false,
|
|
74
75
|
border = true,
|
|
76
|
+
color = themeVars.textColor,
|
|
75
77
|
bgColor = themeVars.transparent,
|
|
78
|
+
fontWeight,
|
|
76
79
|
shrinkable = true,
|
|
77
80
|
clickable = border,
|
|
78
81
|
setMinWidth = true,
|
|
@@ -81,11 +84,14 @@ export const UnitPrimitive = ({
|
|
|
81
84
|
onClick,
|
|
82
85
|
onKeyDown,
|
|
83
86
|
invalid,
|
|
84
|
-
tooltipContent: tooltipChildren,
|
|
85
87
|
}: UnitPrimitiveProps) => {
|
|
86
|
-
const
|
|
88
|
+
const {truncated, setNode} = useTruncated();
|
|
89
|
+
|
|
90
|
+
const truncate = !multiline && overflow;
|
|
87
91
|
const unitWrapperStyle = {
|
|
92
|
+
color,
|
|
88
93
|
backgroundColor: bgColor || themeVars.inputDisabledBgColor,
|
|
94
|
+
fontWeight,
|
|
89
95
|
};
|
|
90
96
|
|
|
91
97
|
const unitWrapperClassName = cx(
|
|
@@ -106,22 +112,18 @@ export const UnitPrimitive = ({
|
|
|
106
112
|
inline={inline}
|
|
107
113
|
style={unitWrapperStyle}
|
|
108
114
|
className={unitWrapperClassName}
|
|
109
|
-
|
|
115
|
+
unit={
|
|
110
116
|
<UnitContentComponent onKeyDown={onKeyDown} onClick={onClick}>
|
|
111
|
-
<UnitContent
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
children={children}
|
|
115
|
-
contentClassName={cx({[textEllipsisClassName]: cutTextInUnit})}
|
|
116
|
-
shrinkable={shrinkable}
|
|
117
|
-
/>
|
|
117
|
+
<UnitContent big={big} icons={icons} shrinkable={shrinkable} truncate={truncate} setNode={setNode}>
|
|
118
|
+
{children}
|
|
119
|
+
</UnitContent>
|
|
118
120
|
</UnitContentComponent>
|
|
119
121
|
}
|
|
120
122
|
navButton={navButton}
|
|
121
123
|
/>
|
|
122
124
|
);
|
|
123
125
|
|
|
124
|
-
const
|
|
126
|
+
const contentWithHeader = header ? (
|
|
125
127
|
<div className={unitWithTitleClassName}>
|
|
126
128
|
<div className={unitTitleClassName}>{title}</div>
|
|
127
129
|
{content}
|
|
@@ -130,41 +132,55 @@ export const UnitPrimitive = ({
|
|
|
130
132
|
content
|
|
131
133
|
);
|
|
132
134
|
|
|
133
|
-
if (tooltip) {
|
|
134
|
-
|
|
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}>
|
|
135
154
|
<UnitButtonGroup
|
|
136
155
|
big={big}
|
|
137
156
|
inline={inline}
|
|
138
157
|
style={unitWrapperStyle}
|
|
139
158
|
className={unitWrapperClassName}
|
|
140
|
-
|
|
141
|
-
<UnitContentComponent
|
|
159
|
+
unit={
|
|
160
|
+
<UnitContentComponent>
|
|
142
161
|
<UnitContent big={big} icons={icons}>
|
|
143
|
-
{
|
|
162
|
+
{children}
|
|
144
163
|
</UnitContent>
|
|
145
164
|
</UnitContentComponent>
|
|
146
165
|
}
|
|
147
166
|
/>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</div>
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
} else {
|
|
168
|
-
return <div className={positionUnitClass}>{contentWithTitle}</div>;
|
|
169
|
-
}
|
|
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
|
+
);
|
|
170
186
|
};
|
package/src/unit/styles.ts
CHANGED
|
@@ -52,10 +52,6 @@ export const unitTitleClassName = css`
|
|
|
52
52
|
padding-top: ${space.s6}px;
|
|
53
53
|
`;
|
|
54
54
|
|
|
55
|
-
export const unitTooltipTitleClassName = css`
|
|
56
|
-
margin-bottom: ${space.s4}px;
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
55
|
export const unitWithTitleClassName = css`
|
|
60
56
|
display: flex;
|
|
61
57
|
flex-direction: column;
|
|
@@ -68,6 +64,10 @@ export const unitWithTitleClassName = css`
|
|
|
68
64
|
export const invalidUnitClassName = css``;
|
|
69
65
|
export const invalidUnitClassNameInForm = css``;
|
|
70
66
|
|
|
67
|
+
export const clickableClassName = css`
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
71
|
export const borderClassName = css`
|
|
72
72
|
position: relative;
|
|
73
73
|
|
|
@@ -88,11 +88,11 @@ export const borderClassName = css`
|
|
|
88
88
|
pointer-events: none;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
&.${clickableClassName}:hover::before {
|
|
92
92
|
box-shadow: ${themeVars.inputBorderHoverColor} inset;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
&.${clickableClassName}:focus::before {
|
|
96
96
|
box-shadow: ${themeVars.inputBorderFocusColor} inset;
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -110,12 +110,12 @@ export const borderClassName = css`
|
|
|
110
110
|
border: 1px solid ${themeVars.colorBorderButtonOutlineAccentDefault};
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
&.${clickableClassName}:hover::before {
|
|
114
114
|
box-shadow: none;
|
|
115
115
|
border: 1px solid ${themeVars.colorBorderReactionsSelectedHover};
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
&.${clickableClassName}:focus::before {
|
|
119
119
|
box-shadow: ${themeVars.inputBorderFocusColor} inset;
|
|
120
120
|
border: none;
|
|
121
121
|
}
|
|
@@ -136,10 +136,6 @@ export const borderClassName = css`
|
|
|
136
136
|
}
|
|
137
137
|
`;
|
|
138
138
|
|
|
139
|
-
export const clickableClassName = css`
|
|
140
|
-
cursor: pointer;
|
|
141
|
-
`;
|
|
142
|
-
|
|
143
139
|
export const basicUnitContentClassName = css`
|
|
144
140
|
padding-left: ${space.s4}px;
|
|
145
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,7 +20,9 @@ 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;
|
|
@@ -28,5 +31,4 @@ export type UnitPrimitiveProps = {
|
|
|
28
31
|
onKeyDown?: (e: KeyboardEvent<HTMLButtonElement | HTMLDivElement>) => void;
|
|
29
32
|
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
30
33
|
invalid?: boolean;
|
|
31
|
-
tooltipContent?: ReactNode;
|
|
32
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
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {CSSProperties, useRef} from "react";
|
|
2
|
-
import {stopPropagation} from "@fibery/react/src/stop-propagation";
|
|
3
|
-
import {Stack} from "./stack";
|
|
4
|
-
import {cx} from "@linaria/core";
|
|
5
|
-
import {hiddenCss, inputCss, textInlineCss} from "./styles";
|
|
6
|
-
import {invalidInputClass} from "./edit-unit-styles";
|
|
7
|
-
|
|
8
|
-
export const TextInlineInputWithAutosize = ({
|
|
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?: React.FocusEventHandler<HTMLInputElement>;
|
|
21
|
-
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
22
|
-
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
23
|
-
onChange: (value: string | number) => void;
|
|
24
|
-
placeholder: string;
|
|
25
|
-
autoFocus: boolean;
|
|
26
|
-
style?: CSSProperties;
|
|
27
|
-
width?: number;
|
|
28
|
-
invalid?: boolean;
|
|
29
|
-
}) => {
|
|
30
|
-
const inputRef = useRef<HTMLInputElement>(null);
|
|
31
|
-
|
|
32
|
-
let hiddenValue = placeholder || "";
|
|
33
|
-
if (value && value.length > hiddenValue.length - 1) {
|
|
34
|
-
hiddenValue = value;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Stack
|
|
39
|
-
bottom={<div className={cx(inputCss, textInlineCss, hiddenCss)}>{hiddenValue}</div>}
|
|
40
|
-
top={
|
|
41
|
-
<input
|
|
42
|
-
// Allow input to shrink (otherwise it has size 20 by default)
|
|
43
|
-
size={1}
|
|
44
|
-
autoFocus={autoFocus}
|
|
45
|
-
ref={inputRef}
|
|
46
|
-
value={value || ""}
|
|
47
|
-
onFocus={onFocus}
|
|
48
|
-
onBlur={onBlur}
|
|
49
|
-
onChange={(e) => onChange?.(e.target.value)}
|
|
50
|
-
onKeyDown={onKeyDown}
|
|
51
|
-
type="text"
|
|
52
|
-
placeholder={placeholder}
|
|
53
|
-
onClick={stopPropagation}
|
|
54
|
-
{...rest}
|
|
55
|
-
className={cx(inputCss, invalid && invalidInputClass)}
|
|
56
|
-
/>
|
|
57
|
-
}
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
60
|
-
};
|
package/src/use-is-phone.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|