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