@fibery/ui-kit 1.17.1 → 1.19.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 (121) hide show
  1. package/index.ts +1 -1
  2. package/package.json +29 -23
  3. package/src/antd/styles.ts +1 -1
  4. package/src/back-button.tsx +3 -0
  5. package/src/{Button → button}/actions-button.tsx +2 -2
  6. package/src/{Button → button}/button-base.tsx +2 -2
  7. package/src/{Button → button}/button-group.tsx +1 -1
  8. package/src/{Button → button}/button.tsx +3 -3
  9. package/src/{Button → button}/icon-button.tsx +1 -0
  10. package/src/button.tsx +3 -0
  11. package/src/create-inline-theme.ts +2 -0
  12. package/src/design-system.ts +1009 -0
  13. package/src/emoji-picker/app-icon-picker.tsx +2 -2
  14. package/src/emoji-picker/emoji-picker-content-with-color.tsx +7 -7
  15. package/src/emoji-picker/emoji-picker.tsx +11 -5
  16. package/src/emoji-picker/icon-emoji-picker.tsx +2 -2
  17. package/src/emoji-picker/primitives/category.tsx +2 -2
  18. package/src/emoji-picker/primitives/content.tsx +3 -2
  19. package/src/emoji-picker/primitives/emoji.tsx +1 -1
  20. package/src/emoji-picker/primitives/footer.tsx +1 -1
  21. package/src/emoji-picker/primitives/header.tsx +1 -1
  22. package/src/emoji-picker/primitives/layout.ts +1 -1
  23. package/src/emoji-picker/primitives/search.tsx +2 -2
  24. package/src/emoji-picker/primitives/skin-tone.tsx +2 -2
  25. package/src/emoji-picker/stores/lazy-emoji-data-store.tsx +3 -3
  26. package/src/emoji-picker/stores/lazy-icon-data-store.tsx +1 -1
  27. package/src/error-alert.tsx +3 -3
  28. package/src/form-field-loader.tsx +1 -1
  29. package/src/icons/Icon.tsx +5 -5
  30. package/src/icons/ast/Activity.ts +1 -1
  31. package/src/icons/ast/BellFilled.ts +8 -0
  32. package/src/icons/ast/BellOff.ts +8 -0
  33. package/src/icons/ast/BellRinging.ts +8 -0
  34. package/src/icons/ast/Clock.ts +8 -0
  35. package/src/icons/ast/ClockAlarm.ts +8 -0
  36. package/src/icons/ast/Copy.ts +1 -1
  37. package/src/icons/ast/Export.ts +8 -0
  38. package/src/icons/ast/ExtensionComments.ts +1 -1
  39. package/src/icons/ast/Favorites.ts +1 -1
  40. package/src/icons/ast/FavoritesChecked.ts +1 -1
  41. package/src/icons/ast/FavoritesOff.ts +8 -0
  42. package/src/icons/ast/GlobeSimple.ts +8 -0
  43. package/src/icons/ast/Import.ts +8 -0
  44. package/src/icons/ast/Lab.ts +8 -0
  45. package/src/icons/ast/Link.ts +8 -0
  46. package/src/icons/ast/Monitor.ts +8 -0
  47. package/src/icons/ast/Network.ts +8 -0
  48. package/src/icons/ast/Pencil.ts +8 -0
  49. package/src/icons/ast/People.ts +8 -0
  50. package/src/icons/ast/RicheditorCommentCreate.ts +1 -1
  51. package/src/icons/ast/RicheditorLinkCreate.ts +1 -1
  52. package/src/icons/ast/RicheditorOpenLink.ts +1 -1
  53. package/src/icons/ast/RicheditorUnlink.ts +1 -1
  54. package/src/icons/ast/ShieldKeyhole.ts +8 -0
  55. package/src/icons/ast/Success.ts +8 -0
  56. package/src/icons/ast/Terminal.ts +8 -0
  57. package/src/icons/ast/TypeUrl.ts +1 -1
  58. package/src/icons/ast/WarningTriangle.ts +8 -0
  59. package/src/icons/ast/index.tsx +19 -4
  60. package/src/icons/{getIconContainerStyle.tsx → get-icon-container-style.tsx} +1 -1
  61. package/src/icons/react/BellFilled.tsx +12 -0
  62. package/src/icons/react/BellOff.tsx +12 -0
  63. package/src/icons/react/BellRinging.tsx +12 -0
  64. package/src/icons/react/Clock.tsx +12 -0
  65. package/src/icons/react/ClockAlarm.tsx +12 -0
  66. package/src/icons/react/Export.tsx +12 -0
  67. package/src/icons/react/FavoritesOff.tsx +12 -0
  68. package/src/icons/react/GlobeSimple.tsx +12 -0
  69. package/src/icons/react/Import.tsx +12 -0
  70. package/src/icons/react/Lab.tsx +12 -0
  71. package/src/icons/react/Link.tsx +12 -0
  72. package/src/icons/react/Monitor.tsx +12 -0
  73. package/src/icons/react/Network.tsx +12 -0
  74. package/src/icons/react/Pencil.tsx +12 -0
  75. package/src/icons/react/People.tsx +12 -0
  76. package/src/icons/react/ShieldKeyhole.tsx +12 -0
  77. package/src/icons/react/Success.tsx +12 -0
  78. package/src/icons/react/Terminal.tsx +12 -0
  79. package/src/icons/react/WarningTriangle.tsx +12 -0
  80. package/src/icons/react/index.tsx +19 -4
  81. package/src/{Item.tsx → item.tsx} +1 -1
  82. package/src/loaders.tsx +19 -6
  83. package/src/loading-sausage.tsx +3 -1
  84. package/src/select/custom-select-partials/clear-indicator.tsx +22 -0
  85. package/src/select/custom-select-partials/drop-down-indicator.tsx +26 -0
  86. package/src/select/custom-select-partials/group-heading.tsx +54 -0
  87. package/src/select/custom-select-partials/menu.tsx +25 -0
  88. package/src/select/custom-select-partials/no-option-message.tsx +10 -0
  89. package/src/select/custom-select-partials/option.tsx +65 -0
  90. package/src/{Select → select}/index.tsx +54 -48
  91. package/src/{Select → select}/select-in-popover.tsx +5 -5
  92. package/src/{Select → select}/styles.ts +9 -53
  93. package/src/{ThemeProvider.tsx → theme-provider.tsx} +11 -1
  94. package/src/theme-styles.ts +2 -5
  95. package/src/toast/primitives.tsx +145 -0
  96. package/src/toast/toast-action.tsx +20 -0
  97. package/src/toast/toast-queue.tsx +121 -0
  98. package/src/toast/toast.tsx +114 -0
  99. package/src/toast/toaster.tsx +72 -0
  100. package/src/tooltip.tsx +3 -3
  101. package/src/BackButton.tsx +0 -3
  102. package/src/Button.tsx +0 -3
  103. package/src/Select/components.tsx +0 -90
  104. package/src/designSystem.ts +0 -951
  105. package/src/icons/ast/AppTemplatesOneColor.ts +0 -8
  106. package/src/icons/ast/CopyUrl.ts +0 -8
  107. package/src/icons/ast/FavoritesMenu.ts +0 -8
  108. package/src/icons/ast/Markdown.ts +0 -8
  109. package/src/icons/react/AppTemplatesOneColor.tsx +0 -12
  110. package/src/icons/react/CopyUrl.tsx +0 -12
  111. package/src/icons/react/FavoritesMenu.tsx +0 -12
  112. package/src/icons/react/Markdown.tsx +0 -12
  113. /package/src/{Button → button}/actions-button-compact.tsx +0 -0
  114. /package/src/{Button/AddButton.tsx → button/add-button.tsx} +0 -0
  115. /package/src/{Button/BackButton.tsx → button/back-button.tsx} +0 -0
  116. /package/src/icons/{generateIconFromAst.ts → generate-icon-from-ast.ts} +0 -0
  117. /package/src/icons/{IconAsPaths.ts → get-paths.ts} +0 -0
  118. /package/src/icons/{getShiftStyle.ts → get-shift-style.ts} +0 -0
  119. /package/src/{Pallete.ts → pallete.ts} +0 -0
  120. /package/src/{Select → select}/select-control-settings-context.tsx +0 -0
  121. /package/src/{Select → select}/select-loader.tsx +0 -0
@@ -0,0 +1,1009 @@
1
+ /* eslint-disable max-lines */
2
+ import chroma from "chroma-js";
3
+ import ColorHash from "color-hash";
4
+ import _ from "lodash";
5
+ import {
6
+ blackA,
7
+ blue,
8
+ blueDark,
9
+ indigo,
10
+ indigoDark,
11
+ red,
12
+ redDark,
13
+ slate,
14
+ slateDark,
15
+ whiteA,
16
+ yellow,
17
+ yellowDark,
18
+ } from "./pallete";
19
+ import {a11yColor} from "./a11y-color";
20
+ import {createInlineTheme as createInlineStyles, varPrefix} from "./create-inline-theme";
21
+ import {ThemeMode} from "./theme-settings";
22
+
23
+ export const typeSizes = [28, 24, 18, 16, 14, 12, 10, 8] as const;
24
+
25
+ export const fontWeight = {
26
+ light: 300,
27
+ regular: 400,
28
+ medium: 500,
29
+ semibold: 600,
30
+ bold: 700,
31
+ } as const;
32
+
33
+ const transparent = "rgba(255, 255, 255, 0)";
34
+
35
+ export const opacity = {
36
+ opacity100: 1,
37
+ opacity95: 0.95,
38
+ opacity90: 0.9,
39
+ opacity85: 0.85,
40
+ opacity80: 0.8,
41
+ opacity75: 0.75,
42
+ opacity70: 0.7,
43
+ opacity65: 0.65,
44
+ opacity60: 0.6,
45
+ opacity55: 0.55,
46
+ opacity50: 0.5,
47
+ opacity45: 0.45,
48
+ opacity40: 0.4,
49
+ opacity35: 0.35,
50
+ opacity30: 0.3,
51
+ opacity25: 0.25,
52
+ opacity20: 0.2,
53
+ opacity15: 0.15,
54
+ opacity10: 0.1,
55
+ opacity5: 0.05,
56
+ opacity0: 0,
57
+ } as const;
58
+
59
+ // switch to chroma.valid once we start using 2.0.1
60
+ const makeChromaColor = (color: string) => {
61
+ try {
62
+ return chroma(color);
63
+ } catch (e) {
64
+ return chroma(brandColors.blue);
65
+ }
66
+ };
67
+
68
+ export const getOpacities = _.memoize((color: string) =>
69
+ _.mapValues(opacity, (opacity) => {
70
+ if (color === transparent) {
71
+ return transparent;
72
+ }
73
+ return makeChromaColor(color).alpha(opacity).css();
74
+ })
75
+ );
76
+
77
+ const shades = getOpacities("#000000");
78
+ const lights = getOpacities("#FFFFFF");
79
+
80
+ export const separators = {
81
+ ..._.mapValues(shades, (shade) => `1px solid ${shade}`),
82
+ } as const;
83
+
84
+ export const inversedSeparators = {
85
+ ..._.mapValues(lights, (light) => `1px solid ${light}`),
86
+ } as const;
87
+
88
+ export const fontFamily =
89
+ "ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica', 'Arial', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'";
90
+
91
+ const stateColors = {
92
+ success: "rgba(8, 189, 159, 1)",
93
+ error: "rgba(234, 105, 63, 1)",
94
+ progress: "rgba(74, 126, 244, 1)",
95
+ canceled: "rgba(233, 163, 76, 1)",
96
+ unknown: "rgba(147, 157, 168, 1)",
97
+ };
98
+
99
+ const brandColors = {
100
+ red: "#FF5400",
101
+ green: "#08BD9F",
102
+ blue: "#4568FB",
103
+ } as const;
104
+
105
+ export const getDarkenColor = _.memoize((color: string): string => {
106
+ return makeChromaColor(color).darken(0.6).css();
107
+ });
108
+
109
+ export const themeColors = {
110
+ mode: ["light", "dark"],
111
+ brandColors: [brandColors, brandColors],
112
+ stateColors: [stateColors, stateColors],
113
+ colorAI: ["hsla(271, 57%, 61%, 1)", "hsla(272, 43%, 50%, 1)"],
114
+ colorBgAI: ["hsla(271, 57%, 61%, 0.1)", "hsla(272, 43%, 50%, 0.1)"],
115
+ actionMenuShadow: [
116
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 12px 16px -4px ${getOpacities(slate.slate10).opacity30}`,
117
+ `0 0 0 1px ${getOpacities(slateDark.slate1).opacity10}, 0 12px 16px -4px ${
118
+ getOpacities(slateDark.slate1).opacity40
119
+ }`,
120
+ ],
121
+ shadowPopup: [
122
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 12px 16px -4px ${getOpacities(slate.slate10).opacity30}`,
123
+ `0 0 0 1px ${getOpacities(slateDark.slate1).opacity10}, 0 12px 16px -4px ${
124
+ getOpacities(slateDark.slate1).opacity40
125
+ }`,
126
+ ],
127
+ shadowModal: [
128
+ `${getOpacities(slate.slate10).opacity20} 0px 16px 70px`,
129
+ `${getOpacities(slateDark.slate1).opacity40} 0px 16px 70px`,
130
+ ],
131
+ shadowSidebar: [
132
+ `-3px 0px 10px 0px ${getOpacities(slate.slate10).opacity10}`,
133
+ `-3px 0px 10px 0px ${getOpacities(slateDark.slate1).opacity80}`,
134
+ ],
135
+ effectBgActionsMenu: [
136
+ `blur(12px) saturate(190%) contrast(50%) brightness(130%)`,
137
+ `blur(12px) saturate(180%) contrast(60%) brightness(70%)`,
138
+ ],
139
+ effectBgPopup: [
140
+ `blur(24px) saturate(190%) contrast(50%) brightness(130%)`,
141
+ `blur(24px) saturate(180%) contrast(60%) brightness(70%)`,
142
+ ],
143
+ primaryBlue: [indigo.indigo9, indigoDark.indigo10],
144
+ whiteColor: [whiteA.whiteA0, whiteA.whiteA0],
145
+ blackColor: [blackA.blackA0, blackA.blackA0],
146
+ mainBg: [slate.slate2, slateDark.slate1],
147
+ panelBg: [whiteA.whiteA0, slateDark.slate2],
148
+ panelContentBg: [slate.slate2, slateDark.slate2],
149
+ pageBg: [whiteA.whiteA0, slateDark.slate1],
150
+ pageContentBg: [whiteA.whiteA0, slateDark.slate2],
151
+ colorBgPopup: [whiteA.whiteA0, slateDark.slate4],
152
+ colorBgSidebar: [whiteA.whiteA0, slateDark.slate3],
153
+ menuBg: [slate.slate2, slateDark.slate2],
154
+ menuTextColor: [slate.slate12, slate.slate8],
155
+ menuItemHoverColor: [slate.slate4, slateDark.slate6],
156
+ menuSelectedTextColor: [slate.slate2, slate.slate2],
157
+ menuFooterColor: [getOpacities(whiteA.whiteA0).opacity20, getOpacities(slateDark.slate3).opacity40],
158
+ menuFooterHoverColor: [getOpacities(whiteA.whiteA0).opacity60, slateDark.slate4],
159
+ menuIconColor: [getOpacities(slate.slate10).opacity90, getOpacities(slate.slate10).opacity90],
160
+ menuSelectedIconColor: [getOpacities(slate.slate1).opacity90, getOpacities(slate.slate1).opacity90],
161
+ textColor: [slateDark.slate3, slate.slate6],
162
+ textSelectionColor: [getOpacities(blue.blue10).opacity20, getOpacities(blueDark.blue10).opacity40],
163
+ accentTextColor: [slate.slate10, slateDark.slate10],
164
+ disabledTextColor: [slate.slate9, slateDark.slate9],
165
+ inversedTextColor: [slate.slate3, slateDark.slate6],
166
+ colorTextSecondary: [getOpacities(slate.slate12).opacity70, getOpacities(slateDark.slate12).opacity65],
167
+ linkColor: [indigoDark.indigo10, indigoDark.indigo11],
168
+ linkBorder: [
169
+ `1px solid ${getOpacities(indigoDark.indigo10).opacity20}`,
170
+ `1px solid ${getOpacities(indigoDark.indigo11).opacity40}`,
171
+ ],
172
+ linkHoverColor: [indigo.indigo10, indigoDark.indigo10],
173
+ linkBorderHover: [
174
+ `1px solid ${getOpacities(indigo.indigo10).opacity80}`,
175
+ `1px solid ${getOpacities(indigoDark.indigo10).opacity80}`,
176
+ ],
177
+ codeColor: [red.red9, red.red8],
178
+ codeBgColor: [slate.slate3, slateDark.slate4],
179
+ codeBlockBgColor: [slate.slate3, slateDark.slate4],
180
+ entityNodeColor: [slateDark.slate3, slate.slate8],
181
+ entityNodeBorder: [
182
+ `1px solid ${getOpacities(slateDark.slate3).opacity30}`,
183
+ `1px solid ${getOpacities(slate.slate8).opacity40}`,
184
+ ],
185
+ entityNodeHoverColor: [slateDark.slate7, slate.slate7],
186
+ entityNodeBorderHover: [
187
+ `1px solid ${getOpacities(slate.slate11).opacity80}`,
188
+ `1px solid ${getOpacities(slate.slate7).opacity80}`,
189
+ ],
190
+ entityNodeBgColor: [slate.slate2, slateDark.slate3],
191
+ shortcutTextColor: [slate.slate9, slateDark.slate11],
192
+ shortcutBorderColor: [
193
+ `1px solid ${getOpacities(slate.slate8).opacity50}`,
194
+ `1px solid ${getOpacities(slateDark.slate10).opacity20}`,
195
+ ],
196
+ inputBgColor: [whiteA.whiteA0, slateDark.slate2],
197
+ inputDisabledBgColor: [getOpacities(slate.slate6).opacity30, getOpacities(slateDark.slate6).opacity30],
198
+ inputDisabledBorderColor: [
199
+ `0 0 0 1px ${getOpacities(slate.slate6).opacity20}`,
200
+ `0 0 0 1px ${getOpacities(slateDark.slate8).opacity20}`,
201
+ ],
202
+ inputCopyBgColor: [slate.slate3, slateDark.slate4],
203
+ inputBorderColor: [
204
+ `0 0 0 1px ${getOpacities(slate.slate6).opacity70}`,
205
+ `0 0 0 1px ${getOpacities(slateDark.slate8).opacity70}`,
206
+ ],
207
+ inputBorderHoverColor: [
208
+ `0 0 0 1px ${getOpacities(slate.slate7).opacity100}`,
209
+ `0 0 0 1px ${getOpacities(slateDark.slate8).opacity100}`,
210
+ ],
211
+ inputBorderFocusColor: [
212
+ `0 0 0 1px ${getOpacities(slate.slate8).opacity100}`,
213
+ `0 0 0 1px ${getOpacities(slateDark.slate9).opacity100}`,
214
+ ],
215
+ inputBorderBlendMode: ["multiply", "lighten"],
216
+ inputPlaceholderTextColor: [slate.slate9, slateDark.slate9],
217
+ inputErrorBorderColor: [`0 0 0 1px ${red.red11}`, `0 0 0 1px ${red.red7}`],
218
+ inputErrorBorderHoverColor: [
219
+ `0 0 0 1px ${getOpacities(red.red11).opacity40}`,
220
+ `0 0 0 1px ${getOpacities(red.red7).opacity40}`,
221
+ ],
222
+ inputErrorBorderFocusColor: [
223
+ `0 0 0 1px ${getOpacities(red.red11).opacity25}`,
224
+ `0 0 0 1px ${getOpacities(red.red7).opacity25}`,
225
+ ],
226
+ inputErrorBorderFocusShadow: [
227
+ `0 0 0 3px ${getOpacities(red.red11).opacity25}`,
228
+ `0 0 0 3px ${getOpacities(red.red7).opacity25}`,
229
+ ],
230
+ buttonPrimaryColor: [indigo.indigo10, indigoDark.indigo10],
231
+ buttonColor: [slate.slate10, slateDark.slate10],
232
+ buttonPrimaryTextColor: [slate.slate2, slate.slate6],
233
+ checkboxColor: [slate.slate10, slateDark.slate10],
234
+ colorBgActionsMenu: [getOpacities(whiteA.whiteA0).opacity85, getOpacities(slateDark.slate4).opacity85],
235
+ colorBgActionsMenuItemHover: [getOpacities(slate.slate11).opacity10, getOpacities(slateDark.slate11).opacity10],
236
+ colorBgActionsMenuItemDangerHover: [getOpacities(red.red9).opacity10, getOpacities(redDark.red10).opacity10],
237
+ colorBgActionsMenuItemDangerActive: [getOpacities(red.red9).opacity80, getOpacities(redDark.red10).opacity80],
238
+ actionMenuBg: [whiteA.whiteA0, slateDark.slate4],
239
+ actionMenuInnerBg: [whiteA.whiteA0, slateDark.slate5],
240
+ actionMenuHover: [slate.slate4, slateDark.slate6],
241
+ actionMenuInnerHover: [slate.slate4, getOpacities(slateDark.slate7).opacity50],
242
+ actionMenuButtonColor: [whiteA.whiteA0, slateDark.slate2],
243
+ actionMenuButtonHoverColor: [slate.slate1, slateDark.slate3],
244
+ actionMenuButtonShadow: [
245
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${getOpacities(slate.slate10).opacity20}`,
246
+ `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 2px 4px -4px ${getOpacities(slateDark.slate2).opacity20}`,
247
+ ],
248
+ actionMenuButtonShadowHover: [
249
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 6px 8px -4px ${getOpacities(slate.slate10).opacity30}`,
250
+ `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 6px 8px -4px ${getOpacities(slateDark.slate2).opacity30}`,
251
+ ],
252
+ separatorColor: [getOpacities(slate.slate4).opacity50, getOpacities(slateDark.slate8).opacity50],
253
+ separatorBreadcrumbsColor: [slate.slate8, slateDark.slate8],
254
+ iconColor: [slate.slate10, slateDark.slate10],
255
+ appIconColor: [getOpacities(slate.slate2).opacity90, getOpacities(slate.slate2).opacity70],
256
+ appIconBgColor: [getOpacities(slate.slate1).opacity90, getOpacities(slate.slate2).opacity50],
257
+ mentionBgColor: [slate.slate3, slateDark.slate5],
258
+ colorBgSelectMenu: [slate.slate1, slateDark.slate3],
259
+ shadowSelectMenu: [
260
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 12px 16px -4px ${getOpacities(slate.slate10).opacity30}`,
261
+ `0 0 0 1px ${getOpacities(slateDark.slate1).opacity10}, 0 12px 16px -4px ${
262
+ getOpacities(slateDark.slate1).opacity40
263
+ }`,
264
+ ],
265
+ colorBgListItemGeneral: [transparent, transparent],
266
+ colorBgListItemGeneralHover: [slate.slate3, slateDark.slate4],
267
+ colorBgListItemGeneralFocus: [slate.slate4, slateDark.slate6],
268
+ colorBgListItemGeneralSelected: [indigo.indigo3, indigoDark.indigo4],
269
+ colorBgListItemGeneralSelectedHover: [indigo.indigo4, indigoDark.indigo6],
270
+ colorBgListItemGeneralSelectedFocus: [indigo.indigo4, indigoDark.indigo6],
271
+ colorBgListItemGeneralDisabled: [transparent, transparent],
272
+ colorTextListItemGeneralDisabled: [slate.slate9, slateDark.slate9],
273
+ colorBgListItemGeneralSelectedDisabled: [indigo.indigo5, indigoDark.indigo5],
274
+ opacityListItemGeneralDisabled: [`${opacity.opacity40}`, `${opacity.opacity40}`],
275
+
276
+ // Search Items
277
+ colorBgSearchItemHover: [slate.slate4, slateDark.slate4],
278
+ opacitySearchItemDone: [`${opacity.opacity40}`, `${opacity.opacity40}`],
279
+ // Entity Box Style And States
280
+ // Basic Entity Box State
281
+ colorBgEntityBoxDefault: [whiteA.whiteA0, slateDark.slate3],
282
+ shadowStrokeEntityBoxDefault: [`0 0 0 1px ${slate.slate5}`, `0 0 0 1px ${slateDark.slate5}`],
283
+ shadowEntityBoxDefault: [
284
+ `0px 2px 4px 0px ${getOpacities(slate.slate12).opacity5}`,
285
+ `0px 2px 4px 0px ${getOpacities(slateDark.slate1).opacity5}`,
286
+ ],
287
+ // :hover
288
+ colorBgEntityBoxDefaultHover: [whiteA.whiteA0, slateDark.slate4],
289
+ shadowEntityBoxDefaultHover: [
290
+ `0px 4px 8px 0px ${getOpacities(slate.slate12).opacity10}`,
291
+ `0px 4px 8px 0px ${getOpacities(slateDark.slate1).opacity10}`,
292
+ ],
293
+ // :focus
294
+ colorBgEntityBoxDefaultFocus: [whiteA.whiteA0, slateDark.slate3],
295
+ shadowStrokeEntityBoxDefaultFocus: [
296
+ `0 0 0 2px ${getOpacities(indigo.indigo9).opacity20}`,
297
+ `0 0 0 2px ${getOpacities(indigoDark.indigo9).opacity20}`,
298
+ ],
299
+ // :focus:hover
300
+ colorBgEntityBoxDefaultFocusHover: [whiteA.whiteA0, slateDark.slate4],
301
+ shadowStrokeEntityBoxDefaultFocusHover: [
302
+ `0 0 0 2px ${getOpacities(indigo.indigo9).opacity40}`,
303
+ `0 0 0 2px ${getOpacities(indigoDark.indigo9).opacity40}`,
304
+ ],
305
+ //::drag
306
+ opacityEntityBoxDefaultDrag: [`${opacity.opacity40}`, `${opacity.opacity40}`],
307
+ shadowEntityBoxDefaultDrag: [
308
+ `0px 8px 12px 0px ${getOpacities(slate.slate12).opacity10}`,
309
+ `0px 8px 12px 0px ${getOpacities(slateDark.slate1).opacity10}`,
310
+ ],
311
+ // Selected Entity Box State
312
+ colorBgEntityBoxSelected: [indigo.indigo2, indigoDark.indigo3],
313
+ shadowStrokeEntityBoxSelected: [
314
+ `0 0 0 1px ${getOpacities(indigo.indigo9).opacity40}, 0 0 0 3px ${getOpacities(indigo.indigo9).opacity40}`,
315
+ `0 0 0 1px ${indigoDark.indigo9}, 0 0 0 3px ${getOpacities(indigoDark.indigo9).opacity40}`,
316
+ ],
317
+ // :hover
318
+ colorBgEntityBoxSelectedHover: [indigo.indigo3, indigoDark.indigo3],
319
+ shadowStrokeEntityBoxSelectedHover: [
320
+ `0 0 0 1px ${getOpacities(indigo.indigo9).opacity60}, 0 0 0 3px ${getOpacities(indigo.indigo9).opacity40}`,
321
+ `0 0 0 1px ${indigoDark.indigo9}, 0 0 0 3px ${getOpacities(indigoDark.indigo9).opacity40}`,
322
+ ],
323
+ //::drag
324
+ colorBgEntityBoxSelectedDrag: [indigo.indigo3, indigoDark.indigo3],
325
+ shadowStrokeEntityBoxSelectedDrag: [
326
+ `0 0 0 1px ${getOpacities(indigo.indigo9).opacity40}, 0 0 0 3px ${getOpacities(indigo.indigo9).opacity40}`,
327
+ `0 0 0 1px ${indigoDark.indigo9}, 0 0 0 3px ${getOpacities(indigoDark.indigo9).opacity40}`,
328
+ ],
329
+ // Disabled Entity Box State (done)
330
+ opacityEntityBoxDisabled: [`${opacity.opacity65}`, `${opacity.opacity65}`],
331
+ // :hover
332
+ opacityEntityBoxDisabledHover: [`${opacity.opacity75}`, `${opacity.opacity75}`],
333
+ // :focus
334
+ opacityEntityBoxDisabledFocus: [`${opacity.opacity75}`, `${opacity.opacity75}`],
335
+ // :drag
336
+ opacityEntityBoxDisabledDrag: [`${opacity.opacity40}`, `${opacity.opacity40}`],
337
+ // Entity Old
338
+ entityCardBgColor: [whiteA.whiteA0, slateDark.slate5],
339
+ entityCardSelectedColor: [getOpacities(slate.slate2).opacity80, getOpacities(slateDark.slate6).opacity50],
340
+ entityCardHoverColor: [getOpacities(slate.slate2).opacity80, getOpacities(slateDark.slate6).opacity50],
341
+ entityCardDoneColor: [getOpacities(slate.slate4).opacity30, getOpacities(slateDark.slate5).opacity30],
342
+ entityCardShadow: [
343
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${getOpacities(slate.slate10).opacity20}`,
344
+ `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 2px 4px -4px ${getOpacities(slateDark.slate2).opacity20}`,
345
+ ],
346
+ entityCardShadowHover: [
347
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${getOpacities(slate.slate10).opacity20}`,
348
+ `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 2px 4px -4px ${getOpacities(slateDark.slate2).opacity20}`,
349
+ ],
350
+
351
+ // Main Menu Items Styles and States
352
+ // Dragged
353
+ opacityMenuItemDragged: [`${opacity.opacity40}`, `${opacity.opacity40}`],
354
+ colorBgMenuItemSelectedDragged: [indigo.indigo6, indigoDark.indigo6],
355
+ // Default
356
+ colorTextMenuItem: [slate.slate12, slateDark.slate12],
357
+ colorBgMenuItem: [transparent, transparent],
358
+ // :hover
359
+ colorBgMenuItemHover: [slate.slate4, slateDark.slate4],
360
+ // :focus
361
+ colorBgMenuItemFocus: [slate.slate6, slateDark.slate6],
362
+ // Selected
363
+ colorBgMenuItemSelected: [indigo.indigo4, indigoDark.indigo4],
364
+ // :hover
365
+ colorBgMenuItemSelectedHover: [indigo.indigo6, indigoDark.indigo6],
366
+ // :focus, :focus:hover
367
+ colorBgMenuItemSelectedFocused: [indigo.indigo6, indigoDark.indigo6],
368
+ allowedDropColor: [getOpacities(slate.slate3).opacity80, getOpacities(slateDark.slate3).opacity80],
369
+ relationViewBgColor: [slate.slate2, slateDark.slate3],
370
+ unitBg: [slate.slate3, slateDark.slate6],
371
+ unitBgHover: [slate.slate4, slateDark.slate7],
372
+ badgeBgColor: [getOpacities(slate.slate10).opacity20, getOpacities(slate.slate10).opacity20],
373
+ panelBadgeBgColor: [getOpacities(slate.slate10).opacity20, getOpacities(slate.slate10).opacity20],
374
+ tooltipBgColor: [slateDark.slate5, slateDark.slate6],
375
+ todayMarkerColor: [red.red8, redDark.red6],
376
+ viewBgOverlayColor: [getOpacities(slate.slate8).opacity20, getOpacities(slateDark.slate1).opacity60],
377
+ floatEditorMenuBg: [slate.slate1, slateDark.slate6],
378
+ floatEditorActiveColor: [indigoDark.indigo10, indigoDark.indigo11],
379
+ planBadgeBgColor: [yellow.yellow10, yellowDark.yellow10],
380
+ commentColor: [getOpacities(yellow.yellow6).opacity60, getOpacities(yellowDark.yellow9).opacity40],
381
+ cellBackgroundColor: [slate.slate2, slateDark.slate2],
382
+ cellBackgroundHoverColor: [getOpacities(slate.slate6).opacity30, getOpacities(slateDark.slate6).opacity30],
383
+ cellBorderColor: [getOpacities(slate.slate8).opacity50, getOpacities(slateDark.slate9).opacity50],
384
+ cellPinnedBorderColor: [getOpacities(slate.slate8).opacity70, getOpacities(slateDark.slate9).opacity70],
385
+ tableRowWarningColor: [getOpacities(yellow.yellow6).opacity60, getOpacities(yellowDark.yellow9).opacity40],
386
+ errorBgColor: [getOpacities(red.red9).opacity20, getOpacities(redDark.red9).opacity60],
387
+ errorTextColor: [red.red11, red.red7],
388
+ errorButtonColor: [red.red9, redDark.red10],
389
+ warningBgColor: [getOpacities(yellow.yellow6).opacity60, getOpacities(yellowDark.yellow8).opacity60],
390
+ warningButtonColor: [yellow.yellow11, yellowDark.yellow11],
391
+ infoBox: [getOpacities(yellow.yellow4).opacity50, getOpacities(yellowDark.yellow9).opacity20],
392
+ appCardBgColor: [whiteA.whiteA0, slateDark.slate2],
393
+ appCardHoverColor: [getOpacities(slate.slate1).opacity95, slateDark.slate2],
394
+ appCardShadow: [
395
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${getOpacities(slate.slate10).opacity20}`,
396
+ `0 0 0 1px ${getOpacities(slateDark.slate8).opacity50}, 0 2px 4px -4px ${getOpacities(slateDark.slate1).opacity50}`,
397
+ ],
398
+ appCardShadowHover: [
399
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 6px 8px -4px ${getOpacities(slate.slate10).opacity30}`,
400
+ `0 0 0 1px ${getOpacities(slateDark.slate8).opacity60}, 0 6px 8px -4px ${
401
+ getOpacities(slateDark.slate1).opacity100
402
+ }`,
403
+ ],
404
+ modalBg: [getOpacities(slate.slate11).opacity20, getOpacities(slateDark.slate2).opacity50],
405
+ modalContentBg: [whiteA.whiteA0, slateDark.slate3],
406
+ progressIconBg: [getOpacities(slate.slate12).opacity10, getOpacities(slateDark.slate12).opacity10],
407
+ progressIconFill: [getOpacities(slate.slate12).opacity80, getOpacities(slateDark.slate12).opacity80],
408
+ progressIconDoneBg: [getOpacities(slate.slate12).opacity80, getOpacities(slateDark.slate12).opacity90],
409
+ progressIconDoneFill: [getOpacities(slate.slate1).opacity95, getOpacities(slateDark.slate1).opacity80],
410
+ instrumentsMenuBg: [getOpacities(whiteA.whiteA0).opacity85, getOpacities(slateDark.slate4).opacity95],
411
+ instrumentsMenuShadow: [
412
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${getOpacities(slate.slate10).opacity20}`,
413
+ `0px 2px 8px ${getOpacities(slate.slate2).opacity95}`,
414
+ ],
415
+ selectedColorBorder: [getOpacities(slate.slate6).opacity50, getOpacities(slate.slate6).opacity20],
416
+ formBg: [slate.slate2, slateDark.slate2],
417
+ formHeaderShadow: [
418
+ `${getOpacities(slate.slate10).opacity10} 0px 0px 6px`,
419
+ `${getOpacities(slateDark.slate1).opacity40} 0px 0px 6px`,
420
+ ],
421
+ formEditorFieldBg: [slate.slate3, slateDark.slate4],
422
+ filterGroup1Bg: [slate.slate2, slateDark.slate6],
423
+ filterGroup2Bg: [slate.slate3, slateDark.slate7],
424
+ filterGroupBorder: [blackA.blackA3, whiteA.whiteA3],
425
+ colorBgNotificationHover: [slate.slate3, slateDark.slate4],
426
+ colorBgNotificationSelected: [indigo.indigo3, indigoDark.indigo4],
427
+ colorBgNotificationSelectedHover: [indigo.indigo4, indigoDark.indigo6],
428
+ disabledInversedTextColor: [shades.opacity25, lights.opacity25],
429
+ danger: [red.red9, redDark.red10],
430
+ active: [red.red9, redDark.red10],
431
+ warning: ["#FFD41E", "#FFD41E"],
432
+ cardBg: ["#FFFFFF", slateDark.slate6],
433
+ cardSelected: ["#FFFB8F", slateDark.slate5],
434
+ cardSelectedHover: ["rgba(240, 244, 247, 0.6)", slateDark.slate5],
435
+ selectedImageBorder: [blackA.blackA8, whiteA.whiteA11],
436
+ transparent: [transparent, transparent],
437
+ shades: [lights, shades],
438
+ lights: [shades, lights],
439
+ separators: [separators, inversedSeparators],
440
+ inversedSeparators: [inversedSeparators, separators],
441
+ progressBg: [slate.slate4, slate.slate4],
442
+ progressText: [slate.slate11, slate.slate11],
443
+ progressFillBg: [slate.slate11, slate.slate11],
444
+ progressFillText: [whiteA.whiteA0, whiteA.whiteA0],
445
+ searchFiltersBg: [slate.slate1, slateDark.slate2],
446
+ colorPickerSwatchBorder: [blackA.blackA7, blackA.blackA7],
447
+ richTextTableBorder: [blackA.blackA5, whiteA.whiteA7],
448
+ gridHeaderBgColor: [slate.slate2, slateDark.slate3],
449
+ gridHeaderHoverBgColor: [slate.slate3, slateDark.slate4],
450
+ gridHeaderTextColor: [slate.slate9, slateDark.slate10],
451
+ gridCellBgColor: [whiteA.whiteA0, slateDark.slate2],
452
+ gridCellBorderColor: [slate.slate5, slateDark.slate6],
453
+ gridPinnedCellBorderColor: [slate.slate8, slateDark.slate8],
454
+ gridDisabledCellBgColor: [slate.slate2, slateDark.slate3],
455
+ gridSelectedCellBgColor: [indigo.indigo3, indigoDark.indigo3],
456
+ gridHighlightedCellBgColor: [indigo.indigo4, indigoDark.indigo5],
457
+ gridSelectedCellBorderColor: [indigo.indigo6, indigoDark.indigo7],
458
+ gridSelectedPinnedCellBorderColor: [indigo.indigo7, indigoDark.indigo7],
459
+ gridDisabledSelectedCellBgColor: [indigo.indigo4, indigoDark.indigo5],
460
+ gridActiveCellBorderColor: [indigo.indigo8, indigoDark.indigo9],
461
+ colorBgReactionsDefault: [slate.slate3, slateDark.slate6],
462
+ colorBgReactionsHover: [slate.slate1, slateDark.slate2],
463
+ colorBorderReactionsHover: [slate.slate8, slateDark.slate9],
464
+ colorBgReactionsSelectedDefault: [indigo.indigo3, indigoDark.indigo8],
465
+ colorBorderReactionsSelectedDefault: [indigo.indigo8, indigoDark.indigo8],
466
+ colorBgReactionsSelectedHover: [indigo.indigo2, indigo.indigo10],
467
+ colorBorderReactionsSelectedHover: [indigo.indigo9, indigo.indigo10],
468
+ colorTextReactionsSelected: [indigo.indigo10, slateDark.slate12],
469
+ colorBgToastDefault: [slate.slate1, slateDark.slate1],
470
+ } as const;
471
+
472
+ type ThemeDefs = typeof themeColors;
473
+
474
+ type GetThemeColors<idx extends number> = {
475
+ [k in keyof ThemeDefs]: ThemeDefs[k][idx];
476
+ };
477
+
478
+ type LightColors = GetThemeColors<0>;
479
+ type DarkColors = GetThemeColors<1>;
480
+
481
+ const lightColors = Object.fromEntries(
482
+ Object.entries(themeColors).map(([key, value]) => {
483
+ return [key, value[0]];
484
+ })
485
+ ) as LightColors;
486
+
487
+ const light2Colors = {
488
+ ...lightColors,
489
+ mode: "light2",
490
+ } as const;
491
+
492
+ const darkColors = Object.fromEntries(
493
+ Object.entries(themeColors).map(([key, value]) => {
494
+ return [key, value[1]];
495
+ })
496
+ ) as DarkColors;
497
+
498
+ export function getLightColors() {
499
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
500
+ // @ts-ignore
501
+ if (process.env.NODE_ENV !== "test") {
502
+ throw new Error("Only for test purpose");
503
+ }
504
+ return lightColors;
505
+ }
506
+
507
+ export function getDarkColors() {
508
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
509
+ // @ts-ignore
510
+ if (process.env.NODE_ENV !== "test") {
511
+ throw new Error("Only for test purpose");
512
+ }
513
+ return darkColors;
514
+ }
515
+
516
+ export function getLight2Colors() {
517
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
518
+ // @ts-ignore
519
+ if (process.env.NODE_ENV !== "test") {
520
+ throw new Error("Only for test purpose");
521
+ }
522
+ return light2Colors;
523
+ }
524
+
525
+ const getDefaultTheme = (): never => {
526
+ throw Error("Please specify theme mode");
527
+ };
528
+
529
+ export function getThemeValue<T>(theme: ThemeMode, values: {light: T; light2?: T; dark: T}): T {
530
+ if (theme in values) {
531
+ return values[theme] as T;
532
+ }
533
+ return values.light;
534
+ }
535
+
536
+ function getTypeColors(themeColor: string, theme: ThemeMode) {
537
+ let color;
538
+ // switch to chroma.valid once we start using 2.0.1
539
+ try {
540
+ chroma(themeColor);
541
+ color = themeColor;
542
+ } catch (e) {
543
+ color = brandColors.green;
544
+ }
545
+ const boardBg = chroma(color).luminance(0.85).desaturate(0.2).set("hsl.h", "+2");
546
+
547
+ const lightTypeColors = {
548
+ primary: color,
549
+ opacity: getOpacities(color),
550
+ darkenPrimary: getDarkenColor(color),
551
+ brightenPrimary: chroma(color).luminance(0.92).desaturate(0.1).alpha(0.98).css(),
552
+ boardBg: boardBg.hex(),
553
+ boardBgOverlay: boardBg.alpha(0.8).css(),
554
+ headerBg: chroma(color).luminance(0.7).desaturate(0.5).set("hsl.h", "+2").css(),
555
+ detailsBg: chroma(color).alpha(0.5).luminance(0.85).hex(),
556
+ focus: chroma(color).alpha(0.25).css(),
557
+ separator: chroma(color).alpha(0.3).css(),
558
+ };
559
+
560
+ const darkTypeColors = {
561
+ primary: color,
562
+ opacity: getOpacities(color),
563
+ darkenPrimary: getDarkenColor(color),
564
+ brightenPrimary: chroma(color).luminance(0.92).desaturate(0.1).alpha(0.98).css(),
565
+ boardBg: boardBg.hex(),
566
+ boardBgOverlay: boardBg.alpha(0.8).css(),
567
+ headerBg: chroma(color).luminance(0.7).desaturate(0.5).set("hsl.h", "+2").css(),
568
+ detailsBg: chroma(color).alpha(0.03).luminance(0.8).desaturate(0.8).darken(0.1).hex(),
569
+ focus: chroma(color).alpha(0.25).css(),
570
+ separator: chroma(color).alpha(0.3).css(),
571
+ };
572
+
573
+ switch (theme) {
574
+ case "light":
575
+ return lightTypeColors;
576
+ case "dark":
577
+ return darkTypeColors;
578
+ case "light2":
579
+ return lightTypeColors;
580
+ default:
581
+ return lightTypeColors;
582
+ }
583
+ }
584
+
585
+ type DesignColor = typeof darkColors | typeof lightColors | typeof light2Colors;
586
+
587
+ export type ThemeColors = ReturnType<typeof getTypeColors> & DesignColor;
588
+
589
+ const colorsByTheme: Record<string, DesignColor> = {
590
+ dark: darkColors,
591
+ light: lightColors,
592
+ light2: light2Colors,
593
+ };
594
+
595
+ export const getThemeColors: (themeColor: string, theme: ThemeMode) => ThemeColors = _.memoize(
596
+ (themeColor: string, theme: ThemeMode = getDefaultTheme()): ThemeColors => {
597
+ const colors = colorsByTheme[theme];
598
+ return {
599
+ ...getTypeColors(themeColor, theme),
600
+ ...colors,
601
+ };
602
+ },
603
+ (themeColor, theme) => themeColor + theme
604
+ );
605
+
606
+ export const getTextColor = _.memoize((color: string): string => {
607
+ return makeChromaColor(color).hex();
608
+ });
609
+
610
+ export const getLinkedHighlightBackgroundColor = _.memoize(
611
+ (themeColors: ThemeColors, color: string): string => {
612
+ switch (themeColors.mode) {
613
+ case "dark":
614
+ return makeChromaColor(color).alpha(0.4).luminance(0.5).css();
615
+ case "light":
616
+ return makeChromaColor(color).alpha(0.3).luminance(0.6).css();
617
+ default:
618
+ return makeChromaColor(color).alpha(0.3).luminance(0.6).css();
619
+ }
620
+ },
621
+ (themeMode, color) => `${themeMode}-${color}`
622
+ );
623
+
624
+ export const getLinkedHighlightDecorationBackgroundColor = _.memoize(
625
+ (themeColors: ThemeColors, color: string): string => {
626
+ switch (themeColors.mode) {
627
+ case "dark":
628
+ return makeChromaColor(color).alpha(0.9).luminance(0.5).darken(0.2).css();
629
+ case "light":
630
+ return makeChromaColor(color).alpha(0.9).luminance(0.5).css();
631
+ default:
632
+ return makeChromaColor(color).alpha(0.9).luminance(0.5).css();
633
+ }
634
+ },
635
+ (themeMode, color) => `${themeMode}-${color}`
636
+ );
637
+
638
+ export const getEnumBackgroundColor = _.memoize(
639
+ (mode: ThemeMode, color: string) => {
640
+ return getThemeValue(mode, {
641
+ light: a11yColor(getOpacities(color).opacity15, lightColors.whiteColor, 1),
642
+ dark: a11yColor(getOpacities(color).opacity30, darkColors.menuBg, 1.3),
643
+ });
644
+ },
645
+ (themeMode, color) => `${themeMode}-${color}`
646
+ );
647
+
648
+ // TODO: fix color for light2. It should same as 'dark' only on dark menu but same as 'light' on other parts of application
649
+ export const getAppIconBackgroundColor = (mode: ThemeMode, color: string) =>
650
+ getThemeValue(mode, {
651
+ dark: a11yColor(getOpacities(color).opacity30, darkColors.menuBg, 1.3),
652
+ light: a11yColor(getOpacities(color).opacity15, lightColors.whiteColor, 1),
653
+ light2: a11yColor(getOpacities(color).opacity30, darkColors.menuBg, 1.3),
654
+ });
655
+
656
+ export const getIconColor = _.memoize(
657
+ (mode: ThemeMode, color: string) =>
658
+ getThemeValue(mode, {
659
+ light: a11yColor(getOpacities(color).opacity95, lightColors.whiteColor, 3),
660
+ dark: a11yColor(getOpacities(color).opacity95, darkColors.menuBg, 5),
661
+ }),
662
+ (themeMode, color) => `${themeMode}-${color}`
663
+ );
664
+
665
+ export const cardTypeColors = [
666
+ "#4A4A4A",
667
+ "#6A849B",
668
+ "#BEC5CC",
669
+ "#D40915",
670
+ "#E72065",
671
+ "#9C2BAF",
672
+ "#673DB6",
673
+ "#3E53B4",
674
+ "#2978FB",
675
+ "#199EE3",
676
+ "#1FBED3",
677
+ "#159789",
678
+ "#4FAF54",
679
+ "#8EC351",
680
+ "#FBA32F",
681
+ "#FC551F",
682
+ "#B04E31",
683
+ ] as const;
684
+
685
+ export const dropCursorColor = chroma(brandColors.blue).alpha(0.7).css();
686
+ export const colors = {
687
+ ...getTypeColors(brandColors.green, "light"),
688
+ brandColors,
689
+ stateColors,
690
+ transparent,
691
+ shades,
692
+ lights,
693
+ inversedTextColor: "#FFFFFF",
694
+ disabledInversedTextColor: lights.opacity25,
695
+ } as const;
696
+
697
+ export const space = {
698
+ xxs: 2, // Not recommended
699
+ xs: 4,
700
+ s: 6,
701
+ m: 8,
702
+ l: 12,
703
+ xl: 24,
704
+ xxl: 48, // Not recommended
705
+ // new spacing set
706
+ spaceAuto: "auto",
707
+ s0: 0,
708
+ s1: 1,
709
+ s2: 2,
710
+ s4: 4,
711
+ s6: 6,
712
+ s8: 8,
713
+ s10: 10,
714
+ s12: 12,
715
+ s14: 14,
716
+ s16: 16,
717
+ s20: 20,
718
+ s24: 24,
719
+ s28: 28,
720
+ s32: 32,
721
+ s36: 36,
722
+ s40: 40,
723
+ s44: 44,
724
+ s48: 48,
725
+ s56: 56,
726
+ s64: 64,
727
+ s80: 80,
728
+ s112: 112,
729
+ s128: 128,
730
+ } as const;
731
+ /** Token for nested items spacing in nested trees */
732
+ export const spaceNestedTreeLevel = 28;
733
+ export const spaceNestedTreeInterval = 0;
734
+ export const layout = {
735
+ logoSize: 24,
736
+ menuDefaultWidth: 243,
737
+ menuMinWidth: 46, //TODO: make dependency to itemHeight
738
+ menuMaxWidth: 480,
739
+ menuItemMinWidth: 80,
740
+ menuGroupHeaderIndent: 40, // I'm ok
741
+ menuItemLevelIndent: 24,
742
+ listItemHeight: 38,
743
+ itemHeight: 36,
744
+ itemWithSubtitleHeight: 52,
745
+ groupTitleHeight: 30,
746
+ menuItemHeight: 32,
747
+ newMenuItemHeight: 30, // I'm ok
748
+ viewHeaderHeight: space.l * 7,
749
+ viewHeaderCompactHeight: 52,
750
+ columnMinWidth: 240,
751
+ columnWidths: {compact: 200, default: 240, list: 280, full: 320},
752
+ objectEditorMinWidth: 480,
753
+ typeEditorWidth: "30vw",
754
+ typeEditorMinWidth: 480,
755
+ viewSetupWidth: "30vw",
756
+ viewSetupMinWidth: 525,
757
+ inputHeight: 36, //TODO: merge input and item height?
758
+ timelineLineHeight: 46,
759
+ timelineGroupPadding: 6,
760
+ timelineItemHeightRatio: 34 / 40,
761
+ timelineHeaderHeight: 30,
762
+ calendarEventHeight: 30,
763
+ calendarHeaderHeight: 30,
764
+ calendarToolbarHeight: 60,
765
+ checkboxSize: 17,
766
+ fakeBoardWidth: 260,
767
+ fakeBoardHeight: 160,
768
+ inlineInputHeight: 32,
769
+ menuHeight: 32,
770
+ popupTopMargin: 48,
771
+ unitHeight: 18,
772
+ } as const;
773
+
774
+ export const border = {
775
+ radius0: 0,
776
+ radius1: 1,
777
+ radius2: 2,
778
+ radius4: 4,
779
+ radius6: 6,
780
+ radius8: 8,
781
+ radius10: 10,
782
+ radius12: 12,
783
+ } as const;
784
+
785
+ export const lineHeight = {
786
+ text: 1.6,
787
+ regular: 1.5,
788
+ heading: 1.25,
789
+ nowrap: 1,
790
+ } as const;
791
+
792
+ export const tooltipDelay = {
793
+ enter: 500,
794
+ leave: 0,
795
+ } as const;
796
+
797
+ export const duration = 120;
798
+ export const easing = "ease-in-out";
799
+ export const transition = `${duration}ms ${easing}`;
800
+
801
+ export const iconSize = 20;
802
+ export const viewBoxSize = "0 0 20 20";
803
+ export const avatarSize = 24;
804
+
805
+ export const shadows = {
806
+ border: `0 0 0 1px ${shades.opacity10}`,
807
+ inversedBorder: `0 0 0 1px ${lights.opacity10}`,
808
+ videoPreview: "0 4px 30px 4px rgba(0, 0, 0, .15)",
809
+ } as const;
810
+
811
+ export const dateFormat = "MMM D, YYYY";
812
+ export const dateTimeFormat = "MMM D, YYYY HH:mm";
813
+ export const timeFormat = "HH:mm";
814
+
815
+ export const getLinearGradient = (backgroundColors: Array<string>): string => {
816
+ const parts = _.flatMap(
817
+ backgroundColors.map((color, index, arr) => [
818
+ `${color} ${(index / arr.length) * 100}%`,
819
+ `${color} ${((index + 1) / arr.length) * 100}%`,
820
+ ])
821
+ );
822
+ return `linear-gradient(to bottom, ${parts.join(", ")})`;
823
+ };
824
+
825
+ export const getObjectColorMemoized = _.memoize((name) => {
826
+ if (!name) {
827
+ return "#999999";
828
+ }
829
+ const colorHash = new ColorHash({
830
+ lightness: [0.5, 0.6, 0.7],
831
+ saturation: [0.6, 0.7, 0.8, 0.9, 1],
832
+ });
833
+ return colorHash.hex(name);
834
+ });
835
+
836
+ export const themeVars = Object.keys(getThemeColors(brandColors.green, "light")).reduce((vars, key) => {
837
+ if (key === "opacity") {
838
+ vars[key] = Object.fromEntries(
839
+ Object.keys(opacity).map((opacityKey) => [opacityKey, `var(--${varPrefix}-opacity-${opacityKey})`])
840
+ );
841
+ } else if (key === "stateColors") {
842
+ vars[key] = Object.fromEntries(
843
+ Object.keys(stateColors).map((stateColorKey) => [
844
+ stateColorKey,
845
+ `var(--${varPrefix}-state-colors-${stateColorKey})`,
846
+ ])
847
+ );
848
+ } else if (key === "brandColors") {
849
+ vars[key] = Object.fromEntries(
850
+ Object.keys(brandColors).map((brandColorKey) => [
851
+ brandColorKey,
852
+ `var(--${varPrefix}-brand-colors-${brandColorKey})`,
853
+ ])
854
+ );
855
+ } else if (key === "shades") {
856
+ vars[key] = Object.fromEntries(
857
+ Object.keys(shades).map((shadeKey) => [shadeKey, `var(--${varPrefix}-shades-${shadeKey})`])
858
+ );
859
+ } else if (key === "lights") {
860
+ vars[key] = Object.fromEntries(
861
+ Object.keys(lights).map((lightKey) => [lightKey, `var(--${varPrefix}-lights-${lightKey})`])
862
+ );
863
+ } else if (key === "separators") {
864
+ vars[key] = Object.fromEntries(
865
+ Object.keys(separators).map((separatorKey) => [separatorKey, `var(--${varPrefix}-separator-${separatorKey})`])
866
+ );
867
+ } else if (key === "inversedSeparators") {
868
+ vars[key] = Object.fromEntries(
869
+ Object.keys(inversedSeparators).map((separatorKey) => [
870
+ separatorKey,
871
+ `var(--${varPrefix}-inversed-separator-${separatorKey})`,
872
+ ])
873
+ );
874
+ } else {
875
+ vars[key] = `var(--${varPrefix}-color-${key})`;
876
+ }
877
+ return vars;
878
+ }, {} as Record<string, string | {[k: string]: string}>) as ThemeColors;
879
+
880
+ const DEFAULT_REJECT_KEYS = Object.keys(lightColors);
881
+ export const createInlineTheme = _.memoize(
882
+ (theme: ThemeColors, rejectKeys = DEFAULT_REJECT_KEYS) => {
883
+ return createInlineStyles<ThemeColors>(theme, rejectKeys);
884
+ },
885
+ (theme, rejectKeys = DEFAULT_REJECT_KEYS) => {
886
+ const rejectKeysLabel = rejectKeys === DEFAULT_REJECT_KEYS ? "DEFAULT_REJECT_KEYS" : JSON.stringify(rejectKeys);
887
+ return `${theme.mode}__${theme.primary}__${rejectKeysLabel}`;
888
+ }
889
+ );
890
+
891
+ export const textStyles = {
892
+ heading1: {
893
+ fontFamily,
894
+ fontSize: typeSizes[0],
895
+ letterSpacing: "-0.003em",
896
+ lineHeight: lineHeight.heading,
897
+ fontWeight: fontWeight.medium,
898
+ color: themeVars.textColor,
899
+ },
900
+ heading2: {
901
+ fontFamily,
902
+ fontSize: typeSizes[1],
903
+ letterSpacing: "-0.002em",
904
+ lineHeight: lineHeight.heading,
905
+ fontWeight: fontWeight.medium,
906
+ color: themeVars.textColor,
907
+ },
908
+ heading3: {
909
+ fontFamily,
910
+ fontSize: typeSizes[2],
911
+ letterSpacing: "-0.002em",
912
+ lineHeight: lineHeight.heading,
913
+ fontWeight: fontWeight.medium,
914
+ color: themeVars.textColor,
915
+ },
916
+ heading4: {
917
+ fontFamily,
918
+ fontSize: typeSizes[3],
919
+ lineHeight: lineHeight.heading,
920
+ fontWeight: fontWeight.medium,
921
+ color: themeVars.textColor,
922
+ },
923
+ heading5: {
924
+ fontFamily,
925
+ fontSize: typeSizes[4],
926
+ lineHeight: lineHeight.heading,
927
+ fontWeight: fontWeight.medium,
928
+ color: themeVars.textColor,
929
+ },
930
+ heading6: {
931
+ fontFamily,
932
+ fontSize: typeSizes[5],
933
+ lineHeight: lineHeight.heading,
934
+ letterSpacing: 0.6,
935
+ textTransform: "uppercase",
936
+ fontWeight: fontWeight.regular,
937
+ color: themeVars.textColor,
938
+ },
939
+ heading7: {
940
+ fontFamily,
941
+ fontSize: typeSizes[6],
942
+ lineHeight: lineHeight.heading,
943
+ letterSpacing: 0.6,
944
+ textTransform: "uppercase",
945
+ fontWeight: fontWeight.regular,
946
+ color: themeVars.textColor,
947
+ },
948
+ big: {
949
+ fontFamily,
950
+ fontSize: typeSizes[3],
951
+ lineHeight: lineHeight.regular,
952
+ fontWeight: fontWeight.regular,
953
+ color: themeVars.textColor,
954
+ },
955
+ regular: {
956
+ fontFamily,
957
+ fontSize: typeSizes[4],
958
+ lineHeight: lineHeight.regular,
959
+ fontWeight: fontWeight.regular,
960
+ color: themeVars.textColor,
961
+ textTransform: "none",
962
+ letterSpacing: "normal",
963
+ },
964
+ small: {
965
+ fontFamily,
966
+ fontSize: typeSizes[5],
967
+ lineHeight: lineHeight.regular,
968
+ fontWeight: fontWeight.regular,
969
+ color: themeVars.textColor,
970
+ textTransform: "none",
971
+ },
972
+ code: {
973
+ fontFamily: '"SFMono-Regular", Menlo, Consolas, "PT Mono", "Liberation Mono", Courier, monospace',
974
+ fontSize: typeSizes[4],
975
+ lineHeight: lineHeight.regular,
976
+ fontWeight: fontWeight.regular,
977
+ color: themeVars.textColor,
978
+ },
979
+ link: {
980
+ color: themeVars.linkColor,
981
+ borderBottom: themeVars.linkBorder,
982
+ textDecoration: "none",
983
+ cursor: "pointer",
984
+ transition: `border ${transition}`,
985
+ },
986
+ inversedLink: {
987
+ color: colors.inversedTextColor,
988
+ cursor: "pointer",
989
+ textDecoration: "underline",
990
+ textDecorationColor: lights.opacity25,
991
+ },
992
+ note: {
993
+ fontFamily,
994
+ fontSize: typeSizes[3],
995
+ lineHeight: lineHeight.regular,
996
+ fontWeight: fontWeight.regular,
997
+ color: themeVars.textColor,
998
+ borderRadius: border.radius6,
999
+ },
1000
+ important: {
1001
+ fontFamily,
1002
+ fontSize: typeSizes[3],
1003
+ lineHeight: lineHeight.regular,
1004
+ fontWeight: fontWeight.regular,
1005
+ color: themeVars.textColor,
1006
+ border: `1px solid ${themeVars.active}`,
1007
+ borderRadius: border.radius6,
1008
+ },
1009
+ } as const;