@fibery/ui-kit 1.36.2 → 1.38.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 (296) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +8 -5
  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 +19 -7
  6. package/src/actions-menu/actions-menu-props.tsx +4 -0
  7. package/src/actions-menu/actions-menu-sub-command-menu.tsx +7 -4
  8. package/src/actions-menu/actions-menu-sub-menu.tsx +9 -3
  9. package/src/actions-menu/actions-menu.tsx +24 -8
  10. package/src/actions-panel.tsx +12 -2
  11. package/src/antd/ant-modal.tsx +17 -2
  12. package/src/antd/input.tsx +4 -3
  13. package/src/app-icon-with-fallback.tsx +5 -8
  14. package/src/app-icon-wrapper.tsx +4 -4
  15. package/src/appIcons.json +20 -0
  16. package/src/axis-header.tsx +136 -76
  17. package/src/badge.tsx +14 -7
  18. package/src/beta-badge.tsx +12 -8
  19. package/src/box.tsx +1 -1
  20. package/src/breadcrumb.tsx +78 -0
  21. package/src/button/actions-button-compact.tsx +5 -2
  22. package/src/button/base-button.tsx +7 -4
  23. package/src/button/button-group.tsx +1 -1
  24. package/src/button/button.tsx +120 -2
  25. package/src/button/icon-button.tsx +13 -2
  26. package/src/button/select-button.tsx +27 -8
  27. package/src/card-container.tsx +36 -69
  28. package/src/card-hidden-link.tsx +52 -0
  29. package/src/collapsible-section.tsx +13 -3
  30. package/src/color-picker/index.js +65 -60
  31. package/src/color-picker/swatch.tsx +29 -14
  32. package/src/command-menu/index.tsx +5 -5
  33. package/src/context-menu/index.tsx +10 -1
  34. package/src/count-badge.tsx +57 -0
  35. package/src/date-picker/date-range-input.tsx +1 -1
  36. package/src/date-picker/date-range-picker.tsx +6 -3
  37. package/src/date-picker/fake-date-input.tsx +1 -1
  38. package/src/date-picker/relative-date-picker.tsx +7 -3
  39. package/src/date-picker/single-date-input.tsx +1 -1
  40. package/src/date-picker/single-date-picker.tsx +8 -5
  41. package/src/date-picker/styles.ts +32 -26
  42. package/src/date-picker/types.ts +3 -1
  43. package/src/date-picker/utils.ts +9 -2
  44. package/src/day-select/day-select.tsx +21 -75
  45. package/src/day-select/iso-week-day-select.tsx +1 -1
  46. package/src/day-select/mount-day-select.tsx +2 -2
  47. package/src/day-select/week-day-select.tsx +1 -5
  48. package/src/design-system.ts +91 -51
  49. package/src/dropdown-menu/index.tsx +8 -1
  50. package/src/emoji-picker/app-icon-picker.tsx +6 -4
  51. package/src/emoji-picker/emoji-picker-content-with-color.tsx +3 -9
  52. package/src/emoji-picker/emoji-picker-preview-footer.tsx +1 -1
  53. package/src/emoji-picker/emoji-picker.tsx +3 -0
  54. package/src/emoji-picker/emoji.tsx +2 -1
  55. package/src/emoji-picker/icon-emoji-picker.tsx +83 -68
  56. package/src/emoji-picker/primitives/footer.tsx +0 -1
  57. package/src/emoji-picker/primitives/header.tsx +1 -0
  58. package/src/emoji-picker/primitives/search.tsx +12 -13
  59. package/src/emoji-picker/primitives/skin-tone.tsx +1 -0
  60. package/src/emoji-picker/use-responsive-emoji-size.ts +11 -0
  61. package/src/emoji-picker/utils/emoji-set.ts +2 -1
  62. package/src/empty-state/empty-state.tsx +6 -0
  63. package/src/error-alert/error-alert.tsx +19 -7
  64. package/src/field-app-icon.tsx +29 -0
  65. package/src/field-container.tsx +4 -2
  66. package/src/field-icon.tsx +29 -0
  67. package/src/field-type-icon.tsx +82 -0
  68. package/src/file-item.tsx +164 -47
  69. package/src/guide-link.tsx +4 -3
  70. package/src/hint.tsx +10 -1
  71. package/src/html-styles.ts +23 -13
  72. package/src/icons/ast/ActivityFilled.ts +8 -0
  73. package/src/icons/ast/AiAssistantFilled.ts +8 -0
  74. package/src/icons/ast/AiFiberyBuild.ts +8 -0
  75. package/src/icons/ast/Anthropic.ts +1 -1
  76. package/src/icons/ast/Apple.ts +8 -0
  77. package/src/icons/ast/ArrowBottom.ts +1 -1
  78. package/src/icons/ast/ArrowForward.ts +1 -1
  79. package/src/icons/ast/ArrowLeft.ts +1 -1
  80. package/src/icons/ast/ArrowRight.ts +1 -1
  81. package/src/icons/ast/ArrowTop.ts +1 -1
  82. package/src/icons/ast/CollapseAllHorizontal.ts +8 -0
  83. package/src/icons/ast/Crosshair.ts +8 -0
  84. package/src/icons/ast/DateRange.ts +1 -1
  85. package/src/icons/ast/Document.ts +8 -0
  86. package/src/icons/ast/EntityCreate.ts +8 -0
  87. package/src/icons/ast/EntityCreateFilled.ts +8 -0
  88. package/src/icons/ast/ExpandAll.ts +8 -0
  89. package/src/icons/ast/ExpandAllHorizontal.ts +8 -0
  90. package/src/icons/ast/FiberyDesktopApp.ts +8 -0
  91. package/src/icons/ast/FileDownload.ts +8 -0
  92. package/src/icons/ast/GlobeUnpublish.ts +8 -0
  93. package/src/icons/ast/GraduationCapFilled.ts +8 -0
  94. package/src/icons/ast/Home.ts +1 -1
  95. package/src/icons/ast/HomeFilled.ts +8 -0
  96. package/src/icons/ast/ImportFilled.ts +8 -0
  97. package/src/icons/ast/IntegrationsFilled.ts +8 -0
  98. package/src/icons/ast/KeyboardHideDown.ts +8 -0
  99. package/src/icons/ast/LayoutMultiple.ts +8 -0
  100. package/src/icons/ast/LocationEdit.ts +8 -0
  101. package/src/icons/ast/MessagePlus.ts +8 -0
  102. package/src/icons/ast/OpenAi.ts +1 -1
  103. package/src/icons/ast/RicheditorHistoryRedo.ts +1 -1
  104. package/src/icons/ast/RicheditorHistoryUndo.ts +1 -1
  105. package/src/icons/ast/RicheditorMarkHighlight.ts +8 -0
  106. package/src/icons/ast/RicheditorMarkStrike.ts +1 -1
  107. package/src/icons/ast/RicheditorMarkUnderline.ts +1 -1
  108. package/src/icons/ast/SearchFilled.ts +8 -0
  109. package/src/icons/ast/SettingsFilled.ts +8 -0
  110. package/src/icons/ast/SlideMenuFilled.ts +8 -0
  111. package/src/icons/ast/SpaceApp.ts +8 -0
  112. package/src/icons/ast/SpaceGenerate.ts +8 -0
  113. package/src/icons/ast/SpaceScratch.ts +8 -0
  114. package/src/icons/ast/SpaceTemplate.ts +8 -0
  115. package/src/icons/ast/TableLayout.ts +8 -0
  116. package/src/icons/ast/TemplatesFilled.ts +8 -0
  117. package/src/icons/ast/ThumbsDown.ts +8 -0
  118. package/src/icons/ast/ThumbsUp.ts +8 -0
  119. package/src/icons/ast/TypeDate.ts +1 -1
  120. package/src/icons/ast/ViewDashboard.ts +8 -0
  121. package/src/icons/ast/WarningTriangleFilled.ts +8 -0
  122. package/src/icons/ast/Windows.ts +8 -0
  123. package/src/icons/ast/index.tsx +37 -0
  124. package/src/icons/react/ActivityFilled.tsx +13 -0
  125. package/src/icons/react/AiAssistantFilled.tsx +13 -0
  126. package/src/icons/react/AiFiberyBuild.tsx +13 -0
  127. package/src/icons/react/Apple.tsx +13 -0
  128. package/src/icons/react/CollapseAllHorizontal.tsx +13 -0
  129. package/src/icons/react/Crosshair.tsx +13 -0
  130. package/src/icons/react/Document.tsx +13 -0
  131. package/src/icons/react/EntityCreate.tsx +13 -0
  132. package/src/icons/react/EntityCreateFilled.tsx +13 -0
  133. package/src/icons/react/ExpandAll.tsx +13 -0
  134. package/src/icons/react/ExpandAllHorizontal.tsx +13 -0
  135. package/src/icons/react/FiberyDesktopApp.tsx +13 -0
  136. package/src/icons/react/FileDownload.tsx +13 -0
  137. package/src/icons/react/GlobeUnpublish.tsx +13 -0
  138. package/src/icons/react/GraduationCapFilled.tsx +13 -0
  139. package/src/icons/react/HomeFilled.tsx +13 -0
  140. package/src/icons/react/ImportFilled.tsx +13 -0
  141. package/src/icons/react/IntegrationsFilled.tsx +13 -0
  142. package/src/icons/react/KeyboardHideDown.tsx +13 -0
  143. package/src/icons/react/LayoutMultiple.tsx +13 -0
  144. package/src/icons/react/LocationEdit.tsx +13 -0
  145. package/src/icons/react/MessagePlus.tsx +13 -0
  146. package/src/icons/react/RicheditorMarkHighlight.tsx +13 -0
  147. package/src/icons/react/SearchFilled.tsx +13 -0
  148. package/src/icons/react/SettingsFilled.tsx +13 -0
  149. package/src/icons/react/SlideMenuFilled.tsx +13 -0
  150. package/src/icons/react/SpaceApp.tsx +13 -0
  151. package/src/icons/react/SpaceGenerate.tsx +13 -0
  152. package/src/icons/react/SpaceScratch.tsx +13 -0
  153. package/src/icons/react/SpaceTemplate.tsx +13 -0
  154. package/src/icons/react/TableLayout.tsx +13 -0
  155. package/src/icons/react/TemplatesFilled.tsx +13 -0
  156. package/src/icons/react/ThumbsDown.tsx +13 -0
  157. package/src/icons/react/ThumbsUp.tsx +13 -0
  158. package/src/icons/react/ViewDashboard.tsx +13 -0
  159. package/src/icons/react/WarningTriangleFilled.tsx +13 -0
  160. package/src/icons/react/Windows.tsx +13 -0
  161. package/src/icons/react/index.tsx +37 -0
  162. package/src/icons/svg/activity-filled.svg +4 -0
  163. package/src/icons/svg/ai-assistant-filled.svg +3 -0
  164. package/src/icons/svg/ai-fibery-build.svg +24 -0
  165. package/src/icons/svg/anthropic.svg +2 -14
  166. package/src/icons/svg/apple.svg +4 -0
  167. package/src/icons/svg/arrow-bottom.svg +1 -1
  168. package/src/icons/svg/arrow-forward.svg +1 -1
  169. package/src/icons/svg/arrow-left.svg +1 -1
  170. package/src/icons/svg/arrow-right.svg +1 -1
  171. package/src/icons/svg/arrow-top.svg +1 -1
  172. package/src/icons/svg/collapse-all-horizontal.svg +3 -0
  173. package/src/icons/svg/crosshair.svg +4 -0
  174. package/src/icons/svg/date-range.svg +3 -3
  175. package/src/icons/svg/document.svg +4 -0
  176. package/src/icons/svg/entity-create-filled.svg +4 -0
  177. package/src/icons/svg/entity-create.svg +3 -0
  178. package/src/icons/svg/expand-all-horizontal.svg +3 -0
  179. package/src/icons/svg/expand-all.svg +3 -0
  180. package/src/icons/svg/fibery-desktop-app.svg +101 -0
  181. package/src/icons/svg/file-download.svg +4 -0
  182. package/src/icons/svg/globe-unpublish.svg +4 -0
  183. package/src/icons/svg/go-to.svg +1 -3
  184. package/src/icons/svg/graduation-cap-filled.svg +4 -0
  185. package/src/icons/svg/home-filled.svg +3 -0
  186. package/src/icons/svg/home.svg +4 -2
  187. package/src/icons/svg/import-filled.svg +4 -0
  188. package/src/icons/svg/integrations-filled.svg +4 -0
  189. package/src/icons/svg/keyboard-hide-down.svg +1 -0
  190. package/src/icons/svg/layout-multiple.svg +3 -0
  191. package/src/icons/svg/location-edit.svg +13 -0
  192. package/src/icons/svg/message-plus.svg +4 -0
  193. package/src/icons/svg/open-ai.svg +2 -7
  194. package/src/icons/svg/open-as-page.svg +2 -3
  195. package/src/icons/svg/richeditor/history/redo.svg +3 -2
  196. package/src/icons/svg/richeditor/history/undo.svg +3 -2
  197. package/src/icons/svg/richeditor/mark/code.svg +4 -5
  198. package/src/icons/svg/richeditor/mark/em.svg +3 -2
  199. package/src/icons/svg/richeditor/mark/highlight.svg +3 -0
  200. package/src/icons/svg/richeditor/mark/strike.svg +3 -2
  201. package/src/icons/svg/richeditor/mark/strong.svg +3 -2
  202. package/src/icons/svg/richeditor/mark/underline.svg +4 -2
  203. package/src/icons/svg/search-filled.svg +3 -0
  204. package/src/icons/svg/settings-filled.svg +3 -0
  205. package/src/icons/svg/slide-menu-filled.svg +1 -0
  206. package/src/icons/svg/space-app.svg +3 -0
  207. package/src/icons/svg/space-generate.svg +3 -0
  208. package/src/icons/svg/space-scratch.svg +3 -0
  209. package/src/icons/svg/space-template.svg +3 -0
  210. package/src/icons/svg/table-layout.svg +3 -0
  211. package/src/icons/svg/templates-filled.svg +6 -0
  212. package/src/icons/svg/thumbs-down.svg +3 -0
  213. package/src/icons/svg/thumbs-up.svg +3 -0
  214. package/src/icons/svg/type/date.svg +3 -2
  215. package/src/icons/svg/view-dashboard.svg +5 -0
  216. package/src/icons/svg/warning-triangle-filled.svg +3 -0
  217. package/src/icons/svg/windows.svg +15 -0
  218. package/src/images-gallery/images-gallery.tsx +254 -0
  219. package/src/images-gallery/zoom.tsx +112 -0
  220. package/src/integration-compact-info-button.tsx +3 -1
  221. package/src/is-in-popup.ts +1 -1
  222. package/src/layout-styles.ts +43 -0
  223. package/src/lists/actions-menu-row-surface.tsx +3 -1
  224. package/src/lists/list-row-surface.tsx +9 -2
  225. package/src/loaders.tsx +6 -6
  226. package/src/logo.tsx +16 -9
  227. package/src/mobile-keyboard-aware-popup.tsx +87 -0
  228. package/src/mobile-styles.ts +10 -0
  229. package/src/modal-menu/contexts/modal-menu-context.tsx +22 -0
  230. package/src/modal-menu/contexts/modal-submenu-context.tsx +16 -0
  231. package/src/modal-menu/index.tsx +14 -0
  232. package/src/modal-menu/modal-menu-content.tsx +68 -0
  233. package/src/modal-menu/modal-menu-group.tsx +10 -0
  234. package/src/modal-menu/modal-menu-item.tsx +37 -0
  235. package/src/modal-menu/modal-menu-label.tsx +24 -0
  236. package/src/modal-menu/modal-menu-root.tsx +57 -0
  237. package/src/modal-menu/modal-menu-separator.tsx +14 -0
  238. package/src/modal-menu/modal-menu-trigger.tsx +37 -0
  239. package/src/modal-menu/modal-submenu-content.tsx +49 -0
  240. package/src/modal-menu/modal-submenu-trigger.tsx +34 -0
  241. package/src/modal-menu/modal-submenu.tsx +17 -0
  242. package/src/new-badge.tsx +4 -7
  243. package/src/number-input/text-area-auto-sized.tsx +47 -0
  244. package/src/number-input/text-input-auto-sized.tsx +49 -0
  245. package/src/online-users.tsx +3 -3
  246. package/src/palette.ts +50 -50
  247. package/src/popover/index.tsx +687 -0
  248. package/src/popover/mobile-popup-context.tsx +29 -0
  249. package/src/{popup → popover}/modifiers.tsx +0 -7
  250. package/src/{popup → popover}/popup-modifiers-context.ts +3 -3
  251. package/src/reactions/reaction-button.tsx +30 -45
  252. package/src/reactions/reaction-picker.tsx +39 -45
  253. package/src/rich-text-embed-error.tsx +2 -2
  254. package/src/select/{custom-select-partials → components}/menu.tsx +13 -7
  255. package/src/select/{custom-select-partials → components}/no-option-message.tsx +0 -1
  256. package/src/select/constants.ts +1 -0
  257. package/src/select/index.tsx +143 -148
  258. package/src/select/select-in-popover.tsx +119 -138
  259. package/src/select/styles.ts +60 -24
  260. package/src/shortcut-badge.tsx +1 -0
  261. package/src/tab-nav/tab-nav.tsx +47 -28
  262. package/src/theme-provider.tsx +9 -1
  263. package/src/toast/primitives.tsx +8 -1
  264. package/src/toggle-button/round-toggle-button.tsx +23 -0
  265. package/src/toggle-button/toggle-button-group.tsx +34 -0
  266. package/src/toggle-button/toggle-button.tsx +164 -0
  267. package/src/toggle.tsx +3 -3
  268. package/src/tooltip-if-overflown.tsx +9 -3
  269. package/src/tooltip.tsx +2 -2
  270. package/src/unit/index.tsx +9 -1
  271. package/src/unit/loading-unit-value.tsx +1 -0
  272. package/src/unit/maybe-unit-value.tsx +3 -3
  273. package/src/unit/primitive.tsx +58 -42
  274. package/src/unit/styles.ts +10 -14
  275. package/src/unit/types.ts +4 -2
  276. package/src/unit/unit-button-group.tsx +6 -11
  277. package/src/unit/unit-content.tsx +13 -5
  278. package/src/unit/unit-with-title.tsx +6 -1
  279. package/src/unit/unit-with-tooltip.tsx +24 -9
  280. package/src/use-is-phone.tsx +37 -0
  281. package/src/use-is-support-hover.ts +1 -1
  282. package/src/use-on-screen-keyboard-data.tsx +66 -0
  283. package/src/workflow-progress-icon.tsx +17 -23
  284. package/src/number-input/text-area-with-autosize.tsx +0 -91
  285. package/src/number-input/text-inline-input-with-autosize.tsx +0 -60
  286. package/src/popup/index.tsx +0 -382
  287. package/src/use-is-phone.ts +0 -5
  288. /package/src/{popup → popover}/popup-stack-context.tsx +0 -0
  289. /package/src/{popup → popover}/reference.ts +0 -0
  290. /package/src/{popup → popover}/styles.ts +0 -0
  291. /package/src/{popup → popover}/use-click-outside.ts +0 -0
  292. /package/src/select/{custom-select-partials → components}/clear-indicator.tsx +0 -0
  293. /package/src/select/{custom-select-partials → components}/drop-down-indicator.tsx +0 -0
  294. /package/src/select/{custom-select-partials → components}/group-heading.tsx +0 -0
  295. /package/src/select/{custom-select-partials → components}/menu-list-virtualized.tsx +0 -0
  296. /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;
@@ -150,14 +146,14 @@ export const unitContentContainerClassName = css`
150
146
  `;
151
147
 
152
148
  export const unitDescriptionClassName = css`
153
- margin-bottom: ${space.s4}px;
149
+ margin-bottom: ${space.s1}px;
154
150
  `;
155
151
 
156
152
  export const fullUnitWrapperClassName = css`
157
153
  display: flex;
158
154
  align-items: center;
159
155
  padding: ${space.s6}px;
160
- border-radius: ${space.s4 + space.s1}px;
156
+ border-radius: ${space.s5}px;
161
157
  background-color: ${themeVars.cardBg};
162
158
  margin-bottom: ${space.s4}px;
163
159
  `;
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,37 @@
1
+ import {ReactNode} from "react";
2
+ import {createContext} from "@fibery/react/src/create-context";
3
+ import {useIsMediaQueryMatched} from "./use-is-media-query-matched";
4
+ import {getMediaQueryList} from "./media-query-utils";
5
+
6
+ const [Provider, useIsPhone] = createContext<boolean>("PhoneContext", false);
7
+
8
+ export {useIsPhone};
9
+
10
+ declare global {
11
+ const __DISABLE_VERTICAL_MOBILE_BREAKPOINT__: boolean | undefined;
12
+ }
13
+
14
+ function isVerticalMobileBreakpointDisabled() {
15
+ // noinspection PointlessBooleanExpressionJS
16
+ if (
17
+ typeof __DISABLE_VERTICAL_MOBILE_BREAKPOINT__ !== "undefined" &&
18
+ __DISABLE_VERTICAL_MOBILE_BREAKPOINT__ === true
19
+ ) {
20
+ return true;
21
+ }
22
+ const urlParams = new URLSearchParams(window.location.search);
23
+ return urlParams.has("no-vertical-mobile-breakpoint");
24
+ }
25
+
26
+ const phoneMediaQuery = isVerticalMobileBreakpointDisabled()
27
+ ? "(max-width: 440px)"
28
+ : "(max-width: 440px), (max-height: 440px)";
29
+
30
+ export function isPhoneMode() {
31
+ return getMediaQueryList(phoneMediaQuery).matches;
32
+ }
33
+
34
+ export function IsPhoneProvider({children}: {children: ReactNode}) {
35
+ const isPhone = useIsMediaQueryMatched(phoneMediaQuery);
36
+ return <Provider value={isPhone}>{children}</Provider>;
37
+ }
@@ -1,5 +1,5 @@
1
1
  import {useIsMediaQueryMatched} from "./use-is-media-query-matched";
2
2
 
3
3
  export function useIsSupportHover() {
4
- return !useIsMediaQueryMatched("(any-hover: none)");
4
+ return useIsMediaQueryMatched("(any-hover: hover)");
5
5
  }
@@ -0,0 +1,66 @@
1
+ import {ReactNode, useEffect, useState} from "react";
2
+ import {createContext} from "@fibery/react/src/create-context";
3
+ import _ from "lodash";
4
+ import {useIsPhone} from "./use-is-phone";
5
+ import {keyboardHeightVar, mobileKeyboardOpenClassName} from "./mobile-styles";
6
+
7
+ const defaultKeyboardHeight = 350;
8
+
9
+ const [OnScreenKeyboardHeightValueProvider, useOnScreenKeyboardHeight] = createContext<number>(
10
+ "OnScreenKeyboardHeightProvider",
11
+ defaultKeyboardHeight
12
+ );
13
+
14
+ const [IsOnScreenKeyboardOpenedValueProvider, useIsOnScreenKeyboardOpened] = createContext<boolean>(
15
+ "IsOnScreenKeyboardOpenedValueProvider",
16
+ false
17
+ );
18
+
19
+ export function OnScreenKeyboardContextProvider({children}: {children: ReactNode}) {
20
+ const isPhone = useIsPhone();
21
+ const [keyboardHeight, setKeyboardHeight] = useState<number>(defaultKeyboardHeight);
22
+ const [keyboardVisible, setKeyboardVisible] = useState<boolean>(false);
23
+ const [initialViewPortHeight] = useState(() => window.visualViewport?.height || 0);
24
+ useEffect(() => {
25
+ const viewport = window.visualViewport;
26
+ if (!viewport || !isPhone) {
27
+ return _.noop;
28
+ }
29
+
30
+ function viewportHandler() {
31
+ if (viewport) {
32
+ // console.log({height: viewport.height, initialViewPortHeight, windowHeight: window.innerHeight});
33
+ // Calculate keyboard height as difference between window height and viewport height
34
+ const calculatedHeight = Math.max(0, initialViewPortHeight - viewport.height);
35
+ if (calculatedHeight && keyboardHeight !== calculatedHeight && calculatedHeight > 200) {
36
+ setKeyboardHeight(calculatedHeight);
37
+ document.body.style.setProperty(keyboardHeightVar, `${calculatedHeight}px`);
38
+ }
39
+ if (viewport.height !== initialViewPortHeight && !keyboardVisible) {
40
+ const htmlElement = document.querySelector("html");
41
+ htmlElement?.classList.add(mobileKeyboardOpenClassName);
42
+ setKeyboardVisible(true);
43
+ } else if (viewport.height === initialViewPortHeight && keyboardVisible) {
44
+ setKeyboardVisible(false);
45
+ const htmlElement = document.querySelector("html");
46
+ htmlElement?.classList.remove(mobileKeyboardOpenClassName);
47
+ }
48
+ }
49
+ }
50
+
51
+ viewport.addEventListener("resize", viewportHandler);
52
+ // Initial calculation
53
+ viewportHandler();
54
+
55
+ return () => {
56
+ viewport.removeEventListener("resize", viewportHandler);
57
+ };
58
+ }, [initialViewPortHeight, isPhone, keyboardHeight, keyboardVisible]);
59
+ return (
60
+ <OnScreenKeyboardHeightValueProvider value={keyboardHeight}>
61
+ <IsOnScreenKeyboardOpenedValueProvider value={keyboardVisible}>{children}</IsOnScreenKeyboardOpenedValueProvider>
62
+ </OnScreenKeyboardHeightValueProvider>
63
+ );
64
+ }
65
+
66
+ export {useOnScreenKeyboardHeight, useIsOnScreenKeyboardOpened};
@@ -22,38 +22,32 @@ 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 (
29
29
  <svg
30
30
  width={size}
31
31
  height={size}
32
- viewBox={`0 0 ${size} ${size}`}
32
+ viewBox={`0 0 16 16`}
33
33
  className={css`
34
34
  display: block;
35
35
  `}
36
36
  >
37
- <g transform={`translate(${size / 2}, ${size / 2})`}>
38
- {isDone ? (
39
- <>
40
- <circle r={size / 2} fill={doneFillColor} />
41
- <polyline
42
- points={`${-size / 4},0 ${-size / 10},${size / 4.5} ${size / 4.5},${-size / 6}`}
43
- stroke={doneStrokeColor}
44
- strokeWidth={size / 8}
45
- strokeLinecap={"round"}
46
- strokeLinejoin={"round"}
47
- fill={"none"}
48
- />
49
- </>
50
- ) : (
51
- <>
52
- <path d={getPath(total, total, size)} fill={fillBackground} />
53
- <path d={getPath(index, total, size)} fill={fillProgress} />
54
- </>
55
- )}
56
- </g>
37
+ {isDone ? (
38
+ <>
39
+ <circle cx="8" cy="8" r="8" fill={doneFillColor} fillOpacity="0.8" />
40
+ <path
41
+ d="M6.93229 11.98C7.25645 11.98 7.5091 11.8562 7.68071 11.5941L12.1236 4.80535C12.2476 4.61478 12.3 4.43852 12.3 4.27178C12.3 3.82395 11.9663 3.5 11.5086 3.5C11.1941 3.5 10.9986 3.61434 10.8079 3.91447L6.90845 10.0601L4.93012 7.60661C4.75374 7.39699 4.56306 7.30171 4.2961 7.30171C3.8337 7.30171 3.5 7.63042 3.5 8.07824C3.5 8.27832 3.56197 8.45464 3.73358 8.64992L6.19339 11.6274C6.39838 11.8704 6.62719 11.98 6.93229 11.98Z"
42
+ fill={doneStrokeColor}
43
+ />
44
+ </>
45
+ ) : (
46
+ <g transform={`translate(8, 8)`}>
47
+ <path d={getPath(total, total, 16)} fill={fillBackground} />
48
+ <path d={getPath(index, total, 16)} fill={fillProgress} />
49
+ </g>
50
+ )}
57
51
  </svg>
58
52
  );
59
53
  };
@@ -63,7 +57,7 @@ const getPath = _.memoize(
63
57
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
64
58
  // @ts-ignore bad d3-shape typings
65
59
  return arc()
66
- .innerRadius(size / 3)
60
+ .innerRadius(size / 2.75)
67
61
  .outerRadius(size / 2)
68
62
  .startAngle(0)
69
63
  .endAngle(2 * (index / total) * Math.PI)
@@ -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
- };