@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.
Files changed (186) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +1 -1
  3. package/src/action-badge.tsx +5 -4
  4. package/src/actions-menu/actions-menu-confirmation.tsx +1 -12
  5. package/src/actions-menu/actions-menu-item.tsx +1 -1
  6. package/src/antd/ant-modal.tsx +17 -2
  7. package/src/antd/input.tsx +4 -3
  8. package/src/app-icon-with-fallback.tsx +5 -8
  9. package/src/app-icon-wrapper.tsx +4 -4
  10. package/src/appIcons.json +20 -0
  11. package/src/badge.tsx +14 -7
  12. package/src/beta-badge.tsx +12 -8
  13. package/src/button/actions-button-compact.tsx +1 -1
  14. package/src/button/base-button.tsx +2 -1
  15. package/src/button/button.tsx +89 -2
  16. package/src/button/icon-button.tsx +4 -2
  17. package/src/button/select-button.tsx +23 -8
  18. package/src/card-container.tsx +29 -65
  19. package/src/card-hidden-link.tsx +52 -0
  20. package/src/collapsible-section.tsx +13 -3
  21. package/src/color-picker/index.js +65 -60
  22. package/src/color-picker/swatch.tsx +28 -14
  23. package/src/command-menu/index.tsx +2 -2
  24. package/src/count-badge.tsx +57 -0
  25. package/src/date-picker/date-range-input.tsx +1 -1
  26. package/src/date-picker/fake-date-input.tsx +1 -1
  27. package/src/date-picker/relative-date-picker.tsx +1 -1
  28. package/src/date-picker/single-date-input.tsx +1 -1
  29. package/src/date-picker/utils.ts +9 -2
  30. package/src/design-system.ts +72 -41
  31. package/src/emoji-picker/emoji-picker-content-with-color.tsx +3 -9
  32. package/src/emoji-picker/icon-emoji-picker.tsx +75 -69
  33. package/src/emoji-picker/primitives/header.tsx +1 -0
  34. package/src/emoji-picker/primitives/search.tsx +12 -13
  35. package/src/error-alert/error-alert.tsx +19 -7
  36. package/src/field-app-icon.tsx +29 -0
  37. package/src/field-container.tsx +4 -2
  38. package/src/field-icon.tsx +26 -0
  39. package/src/field-type-icon.tsx +82 -0
  40. package/src/guide-link.tsx +4 -3
  41. package/src/hint.tsx +10 -1
  42. package/src/html-styles.ts +15 -13
  43. package/src/icons/ast/AiFiberyBuild.ts +8 -0
  44. package/src/icons/ast/Anthropic.ts +1 -1
  45. package/src/icons/ast/Apple.ts +8 -0
  46. package/src/icons/ast/ArrowBottom.ts +1 -1
  47. package/src/icons/ast/ArrowForward.ts +1 -1
  48. package/src/icons/ast/ArrowLeft.ts +1 -1
  49. package/src/icons/ast/ArrowRight.ts +1 -1
  50. package/src/icons/ast/ArrowTop.ts +1 -1
  51. package/src/icons/ast/Crosshair.ts +8 -0
  52. package/src/icons/ast/Document.ts +8 -0
  53. package/src/icons/ast/EntityCreate.ts +8 -0
  54. package/src/icons/ast/ExpandAll.ts +8 -0
  55. package/src/icons/ast/FiberyDesktopApp.ts +8 -0
  56. package/src/icons/ast/FileDownload.ts +8 -0
  57. package/src/icons/ast/GraduationCapFilled.ts +8 -0
  58. package/src/icons/ast/Home.ts +1 -1
  59. package/src/icons/ast/ImportFilled.ts +8 -0
  60. package/src/icons/ast/IntegrationsFilled.ts +8 -0
  61. package/src/icons/ast/LocationEdit.ts +8 -0
  62. package/src/icons/ast/MessagePlus.ts +8 -0
  63. package/src/icons/ast/OpenAi.ts +1 -1
  64. package/src/icons/ast/RicheditorMarkHighlight.ts +8 -0
  65. package/src/icons/ast/RicheditorMarkStrike.ts +1 -1
  66. package/src/icons/ast/RicheditorMarkUnderline.ts +1 -1
  67. package/src/icons/ast/SpaceApp.ts +8 -0
  68. package/src/icons/ast/SpaceGenerate.ts +8 -0
  69. package/src/icons/ast/SpaceScratch.ts +8 -0
  70. package/src/icons/ast/SpaceTemplate.ts +8 -0
  71. package/src/icons/ast/TableLayout.ts +8 -0
  72. package/src/icons/ast/TemplatesFilled.ts +8 -0
  73. package/src/icons/ast/ThumbsDown.ts +8 -0
  74. package/src/icons/ast/ThumbsUp.ts +8 -0
  75. package/src/icons/ast/ViewDashboard.ts +8 -0
  76. package/src/icons/ast/WarningTriangleFilled.ts +8 -0
  77. package/src/icons/ast/Windows.ts +8 -0
  78. package/src/icons/ast/index.tsx +25 -0
  79. package/src/icons/react/AiFiberyBuild.tsx +13 -0
  80. package/src/icons/react/Apple.tsx +13 -0
  81. package/src/icons/react/Crosshair.tsx +13 -0
  82. package/src/icons/react/Document.tsx +13 -0
  83. package/src/icons/react/EntityCreate.tsx +13 -0
  84. package/src/icons/react/ExpandAll.tsx +13 -0
  85. package/src/icons/react/FiberyDesktopApp.tsx +13 -0
  86. package/src/icons/react/FileDownload.tsx +13 -0
  87. package/src/icons/react/GraduationCapFilled.tsx +13 -0
  88. package/src/icons/react/ImportFilled.tsx +13 -0
  89. package/src/icons/react/IntegrationsFilled.tsx +13 -0
  90. package/src/icons/react/LocationEdit.tsx +13 -0
  91. package/src/icons/react/MessagePlus.tsx +13 -0
  92. package/src/icons/react/RicheditorMarkHighlight.tsx +13 -0
  93. package/src/icons/react/SpaceApp.tsx +13 -0
  94. package/src/icons/react/SpaceGenerate.tsx +13 -0
  95. package/src/icons/react/SpaceScratch.tsx +13 -0
  96. package/src/icons/react/SpaceTemplate.tsx +13 -0
  97. package/src/icons/react/TableLayout.tsx +13 -0
  98. package/src/icons/react/TemplatesFilled.tsx +13 -0
  99. package/src/icons/react/ThumbsDown.tsx +13 -0
  100. package/src/icons/react/ThumbsUp.tsx +13 -0
  101. package/src/icons/react/ViewDashboard.tsx +13 -0
  102. package/src/icons/react/WarningTriangleFilled.tsx +13 -0
  103. package/src/icons/react/Windows.tsx +13 -0
  104. package/src/icons/react/index.tsx +25 -0
  105. package/src/icons/svg/ai-fibery-build.svg +24 -0
  106. package/src/icons/svg/anthropic.svg +2 -14
  107. package/src/icons/svg/apple.svg +4 -0
  108. package/src/icons/svg/arrow-bottom.svg +1 -1
  109. package/src/icons/svg/arrow-forward.svg +1 -1
  110. package/src/icons/svg/arrow-left.svg +1 -1
  111. package/src/icons/svg/arrow-right.svg +1 -1
  112. package/src/icons/svg/arrow-top.svg +1 -1
  113. package/src/icons/svg/crosshair.svg +4 -0
  114. package/src/icons/svg/document.svg +4 -0
  115. package/src/icons/svg/entity-create.svg +3 -0
  116. package/src/icons/svg/expand-all.svg +3 -0
  117. package/src/icons/svg/fibery-desktop-app.svg +101 -0
  118. package/src/icons/svg/file-download.svg +4 -0
  119. package/src/icons/svg/go-to.svg +1 -3
  120. package/src/icons/svg/graduation-cap-filled.svg +4 -0
  121. package/src/icons/svg/home.svg +4 -2
  122. package/src/icons/svg/import-filled.svg +4 -0
  123. package/src/icons/svg/integrations-filled.svg +4 -0
  124. package/src/icons/svg/location-edit.svg +13 -0
  125. package/src/icons/svg/message-plus.svg +4 -0
  126. package/src/icons/svg/open-ai.svg +2 -7
  127. package/src/icons/svg/open-as-page.svg +2 -3
  128. package/src/icons/svg/richeditor/mark/code.svg +4 -5
  129. package/src/icons/svg/richeditor/mark/em.svg +3 -2
  130. package/src/icons/svg/richeditor/mark/highlight.svg +3 -0
  131. package/src/icons/svg/richeditor/mark/strike.svg +3 -2
  132. package/src/icons/svg/richeditor/mark/strong.svg +3 -2
  133. package/src/icons/svg/richeditor/mark/underline.svg +4 -2
  134. package/src/icons/svg/space-app.svg +3 -0
  135. package/src/icons/svg/space-generate.svg +3 -0
  136. package/src/icons/svg/space-scratch.svg +3 -0
  137. package/src/icons/svg/space-template.svg +3 -0
  138. package/src/icons/svg/table-layout.svg +3 -0
  139. package/src/icons/svg/templates-filled.svg +6 -0
  140. package/src/icons/svg/thumbs-down.svg +3 -0
  141. package/src/icons/svg/thumbs-up.svg +3 -0
  142. package/src/icons/svg/view-dashboard.svg +5 -0
  143. package/src/icons/svg/warning-triangle-filled.svg +3 -0
  144. package/src/icons/svg/windows.svg +15 -0
  145. package/src/integration-compact-info-button.tsx +3 -1
  146. package/src/layout-styles.ts +23 -0
  147. package/src/lists/list-row-surface.tsx +2 -1
  148. package/src/loaders.tsx +6 -6
  149. package/src/logo.tsx +16 -9
  150. package/src/mobile-styles.ts +2 -0
  151. package/src/new-badge.tsx +4 -7
  152. package/src/number-input/text-area-auto-sized.tsx +47 -0
  153. package/src/number-input/text-input-auto-sized.tsx +49 -0
  154. package/src/palette.ts +50 -50
  155. package/src/popup/index.tsx +1 -0
  156. package/src/rich-text-embed-error.tsx +2 -2
  157. package/src/select/{custom-select-partials → components}/menu.tsx +13 -7
  158. package/src/select/{custom-select-partials → components}/no-option-message.tsx +0 -1
  159. package/src/select/constants.ts +1 -0
  160. package/src/select/index.tsx +136 -145
  161. package/src/select/select-in-popover.tsx +101 -108
  162. package/src/select/styles.ts +60 -24
  163. package/src/shortcut-badge.tsx +1 -0
  164. package/src/tab-nav/tab-nav.tsx +12 -19
  165. package/src/theme-provider.tsx +9 -1
  166. package/src/tooltip-if-overflown.tsx +9 -3
  167. package/src/unit/index.tsx +9 -1
  168. package/src/unit/loading-unit-value.tsx +1 -0
  169. package/src/unit/maybe-unit-value.tsx +3 -3
  170. package/src/unit/primitive.tsx +58 -42
  171. package/src/unit/styles.ts +8 -12
  172. package/src/unit/types.ts +4 -2
  173. package/src/unit/unit-button-group.tsx +6 -11
  174. package/src/unit/unit-content.tsx +13 -5
  175. package/src/unit/unit-with-title.tsx +6 -1
  176. package/src/unit/unit-with-tooltip.tsx +24 -9
  177. package/src/use-is-phone.tsx +12 -0
  178. package/src/workflow-progress-icon.tsx +1 -1
  179. package/src/number-input/text-area-with-autosize.tsx +0 -91
  180. package/src/number-input/text-inline-input-with-autosize.tsx +0 -60
  181. package/src/use-is-phone.ts +0 -5
  182. /package/src/select/{custom-select-partials → components}/clear-indicator.tsx +0 -0
  183. /package/src/select/{custom-select-partials → components}/drop-down-indicator.tsx +0 -0
  184. /package/src/select/{custom-select-partials → components}/group-heading.tsx +0 -0
  185. /package/src/select/{custom-select-partials → components}/menu-list-virtualized.tsx +0 -0
  186. /package/src/select/{custom-select-partials → components}/option.tsx +0 -0
@@ -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 cutTextInUnit = !multiline && overflow;
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
- unitButton={
115
+ unit={
110
116
  <UnitContentComponent onKeyDown={onKeyDown} onClick={onClick}>
111
- <UnitContent
112
- big={big}
113
- icons={icons}
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 contentWithTitle = header ? (
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
- const tooltipContent = (
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
- unitButton={
141
- <UnitContentComponent onClick={onClick}>
159
+ unit={
160
+ <UnitContentComponent>
142
161
  <UnitContent big={big} icons={icons}>
143
- {tooltipChildren || children}
162
+ {children}
144
163
  </UnitContent>
145
164
  </UnitContentComponent>
146
165
  }
147
166
  />
148
- );
149
- const renderedDescription = (
150
- <div>
151
- {description && <div className={unitDescriptionClassName}>{description}</div>}
152
- <div className={fullUnitWrapperClassName}>{tooltipContent}</div>
153
- {hint}
154
- </div>
155
- );
156
-
157
- return (
158
- <div className={positionUnitClass}>
159
- <UnitWithTooltip
160
- title={<div className={unitTooltipTitleClassName}>{title}</div>}
161
- description={renderedDescription}
162
- >
163
- {contentWithTitle}
164
- </UnitWithTooltip>
165
- </div>
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
  };
@@ -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
- &:hover::before {
91
+ &.${clickableClassName}:hover::before {
92
92
  box-shadow: ${themeVars.inputBorderHoverColor} inset;
93
93
  }
94
94
 
95
- &:focus::before {
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
- &:hover::before {
113
+ &.${clickableClassName}:hover::before {
114
114
  box-shadow: none;
115
115
  border: 1px solid ${themeVars.colorBorderReactionsSelectedHover};
116
116
  }
117
117
 
118
- &:focus::before {
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
- bgColor?: string | null | undefined;
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
- export const UnitButtonGroup = ({
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
- unitButton?: ReactNode;
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
- {unitButton}
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 {alignCenterClassName, basicUnitContentClassName, unitContentContainerClassName} from "./styles";
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, children, contentClassName, shrinkable}: Props) => {
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, contentClassName)}>{children}</div>
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
- export const UnitWithTitle = ({children, title}: {title: React.ReactNode; children: React.ReactElement}) => (
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
- export const UnitWithTooltip = ({
6
- children,
7
- title,
8
- description,
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 visible={shouldDisplayTooltip} title={title} description={description} side="bottom" align="start">
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.whiteColor,
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
- };
@@ -1,5 +0,0 @@
1
- import {useIsMediaQueryMatched} from "./use-is-media-query-matched";
2
-
3
- export function useIsPhone() {
4
- return useIsMediaQueryMatched("(max-width: 420px), (max-height: 420px)");
5
- }