@fibery/ui-kit 1.17.1 → 1.18.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 (101) hide show
  1. package/index.ts +1 -1
  2. package/package.json +26 -21
  3. package/src/Button/actions-button.tsx +2 -2
  4. package/src/Button/button-base.tsx +2 -2
  5. package/src/Button/button-group.tsx +1 -1
  6. package/src/Button/button.tsx +3 -3
  7. package/src/Button/icon-button.tsx +1 -0
  8. package/src/Select/custom-select-partials/clear-indicator.tsx +22 -0
  9. package/src/Select/custom-select-partials/drop-down-indicator.tsx +26 -0
  10. package/src/Select/custom-select-partials/group-heading.tsx +54 -0
  11. package/src/Select/custom-select-partials/menu.tsx +25 -0
  12. package/src/Select/custom-select-partials/no-option-message.tsx +10 -0
  13. package/src/Select/custom-select-partials/option.tsx +92 -0
  14. package/src/Select/index.tsx +18 -47
  15. package/src/Select/select-in-popover.tsx +2 -2
  16. package/src/Select/styles.ts +11 -53
  17. package/src/antd/styles.ts +1 -1
  18. package/src/back-button.tsx +3 -0
  19. package/src/create-inline-theme.ts +2 -0
  20. package/src/design-system.ts +961 -0
  21. package/src/emoji-picker/app-icon-picker.tsx +2 -2
  22. package/src/emoji-picker/emoji-picker-content-with-color.tsx +4 -4
  23. package/src/emoji-picker/emoji-picker.tsx +11 -5
  24. package/src/emoji-picker/icon-emoji-picker.tsx +2 -2
  25. package/src/emoji-picker/primitives/category.tsx +1 -1
  26. package/src/emoji-picker/primitives/content.tsx +3 -2
  27. package/src/emoji-picker/primitives/emoji.tsx +1 -1
  28. package/src/emoji-picker/primitives/footer.tsx +1 -1
  29. package/src/emoji-picker/primitives/header.tsx +1 -1
  30. package/src/emoji-picker/primitives/layout.ts +1 -1
  31. package/src/emoji-picker/primitives/search.tsx +1 -1
  32. package/src/emoji-picker/primitives/skin-tone.tsx +1 -1
  33. package/src/emoji-picker/stores/lazy-emoji-data-store.tsx +3 -3
  34. package/src/emoji-picker/stores/lazy-icon-data-store.tsx +1 -1
  35. package/src/error-alert.tsx +2 -2
  36. package/src/form-field-loader.tsx +1 -1
  37. package/src/icons/Icon.tsx +4 -4
  38. package/src/icons/ast/Activity.ts +1 -1
  39. package/src/icons/ast/BellFilled.ts +8 -0
  40. package/src/icons/ast/BellOff.ts +8 -0
  41. package/src/icons/ast/BellRinging.ts +8 -0
  42. package/src/icons/ast/Export.ts +8 -0
  43. package/src/icons/ast/Favorites.ts +1 -1
  44. package/src/icons/ast/FavoritesChecked.ts +1 -1
  45. package/src/icons/ast/FavoritesOff.ts +8 -0
  46. package/src/icons/ast/GlobeSimple.ts +8 -0
  47. package/src/icons/ast/Import.ts +8 -0
  48. package/src/icons/ast/Lab.ts +8 -0
  49. package/src/icons/ast/Link.ts +8 -0
  50. package/src/icons/ast/Network.ts +8 -0
  51. package/src/icons/ast/Pencil.ts +8 -0
  52. package/src/icons/ast/People.ts +8 -0
  53. package/src/icons/ast/RicheditorLinkCreate.ts +1 -1
  54. package/src/icons/ast/RicheditorOpenLink.ts +1 -1
  55. package/src/icons/ast/RicheditorUnlink.ts +1 -1
  56. package/src/icons/ast/ShieldKeyhole.ts +8 -0
  57. package/src/icons/ast/Terminal.ts +8 -0
  58. package/src/icons/ast/TypeUrl.ts +1 -1
  59. package/src/icons/ast/index.tsx +14 -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/Export.tsx +12 -0
  65. package/src/icons/react/FavoritesOff.tsx +12 -0
  66. package/src/icons/react/GlobeSimple.tsx +12 -0
  67. package/src/icons/react/Import.tsx +12 -0
  68. package/src/icons/react/Lab.tsx +12 -0
  69. package/src/icons/react/Link.tsx +12 -0
  70. package/src/icons/react/Network.tsx +12 -0
  71. package/src/icons/react/Pencil.tsx +12 -0
  72. package/src/icons/react/People.tsx +12 -0
  73. package/src/icons/react/ShieldKeyhole.tsx +12 -0
  74. package/src/icons/react/Terminal.tsx +12 -0
  75. package/src/icons/react/index.tsx +14 -4
  76. package/src/{Item.tsx → item.tsx} +1 -1
  77. package/src/loaders.tsx +19 -6
  78. package/src/loading-sausage.tsx +3 -1
  79. package/src/{ThemeProvider.tsx → theme-provider.tsx} +11 -1
  80. package/src/theme-styles.ts +2 -5
  81. package/src/toast/index.tsx +47 -0
  82. package/src/toast/primitives.tsx +140 -0
  83. package/src/tooltip.tsx +3 -3
  84. package/src/BackButton.tsx +0 -3
  85. package/src/Select/components.tsx +0 -90
  86. package/src/designSystem.ts +0 -951
  87. package/src/icons/ast/AppTemplatesOneColor.ts +0 -8
  88. package/src/icons/ast/CopyUrl.ts +0 -8
  89. package/src/icons/ast/FavoritesMenu.ts +0 -8
  90. package/src/icons/ast/Markdown.ts +0 -8
  91. package/src/icons/react/AppTemplatesOneColor.tsx +0 -12
  92. package/src/icons/react/CopyUrl.tsx +0 -12
  93. package/src/icons/react/FavoritesMenu.tsx +0 -12
  94. package/src/icons/react/Markdown.tsx +0 -12
  95. /package/src/Button/{AddButton.tsx → add-button.tsx} +0 -0
  96. /package/src/Button/{BackButton.tsx → back-button.tsx} +0 -0
  97. /package/src/{Button.tsx → button.tsx} +0 -0
  98. /package/src/icons/{generateIconFromAst.ts → generate-icon-from-ast.ts} +0 -0
  99. /package/src/icons/{IconAsPaths.ts → get-paths.ts} +0 -0
  100. /package/src/icons/{getShiftStyle.ts → get-shift-style.ts} +0 -0
  101. /package/src/{Pallete.ts → pallete.ts} +0 -0
@@ -0,0 +1,961 @@
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
+ colorBgSelectOptionDefault: [transparent, transparent],
266
+ colorBgSelectOptionDefaultHover: [slate.slate4, slateDark.slate4],
267
+ colorBgSelectOptionSelected: [indigo.indigo4, indigoDark.indigo4],
268
+ colorBgSelectOptionSelectedHover: [indigo.indigo6, indigoDark.indigo6],
269
+ colorBgSelectOptionDisabled: [transparent, transparent],
270
+ colorBgSelectOptionSelectedDisabled: [indigo.indigo5, indigoDark.indigo5],
271
+ opacitySelectOptionDisabled: [`${opacity.opacity40}`, `${opacity.opacity40}`],
272
+
273
+ // Search Items
274
+ colorBgSearchItemHover: [slate.slate4, slateDark.slate4],
275
+ opacitySearchItemDone: [`${opacity.opacity40}`, `${opacity.opacity40}`],
276
+ // Entity Box Style And States
277
+ // Basic Entity Box State
278
+ colorBgEntityBoxDefault: [whiteA.whiteA0, slateDark.slate3],
279
+ shadowStrokeEntityBoxDefault: [`0 0 0 1px ${slate.slate5}`, `0 0 0 1px ${slateDark.slate5}`],
280
+ shadowEntityBoxDefault: [
281
+ `0px 2px 4px 0px ${getOpacities(slate.slate12).opacity5}`,
282
+ `0px 2px 4px 0px ${getOpacities(slateDark.slate1).opacity5}`,
283
+ ],
284
+ // :hover
285
+ colorBgEntityBoxDefaultHover: [whiteA.whiteA0, slateDark.slate4],
286
+ shadowEntityBoxDefaultHover: [
287
+ `0px 4px 8px 0px ${getOpacities(slate.slate12).opacity10}`,
288
+ `0px 4px 8px 0px ${getOpacities(slateDark.slate1).opacity10}`,
289
+ ],
290
+ // :focus
291
+ colorBgEntityBoxDefaultFocus: [whiteA.whiteA0, slateDark.slate3],
292
+ shadowStrokeEntityBoxDefaultFocus: [
293
+ `0 0 0 2px ${getOpacities(indigo.indigo9).opacity20}`,
294
+ `0 0 0 2px ${getOpacities(indigoDark.indigo9).opacity20}`,
295
+ ],
296
+ // :focus:hover
297
+ colorBgEntityBoxDefaultFocusHover: [whiteA.whiteA0, slateDark.slate4],
298
+ shadowStrokeEntityBoxDefaultFocusHover: [
299
+ `0 0 0 2px ${getOpacities(indigo.indigo9).opacity40}`,
300
+ `0 0 0 2px ${getOpacities(indigoDark.indigo9).opacity40}`,
301
+ ],
302
+ //::drag
303
+ opacityEntityBoxDefaultDrag: [`${opacity.opacity40}`, `${opacity.opacity40}`],
304
+ shadowEntityBoxDefaultDrag: [
305
+ `0px 8px 12px 0px ${getOpacities(slate.slate12).opacity10}`,
306
+ `0px 8px 12px 0px ${getOpacities(slateDark.slate1).opacity10}`,
307
+ ],
308
+ // Selected Entity Box State
309
+ colorBgEntityBoxSelected: [indigo.indigo2, indigoDark.indigo3],
310
+ shadowStrokeEntityBoxSelected: [
311
+ `0 0 0 1px ${indigo.indigo9}, 0 0 0 3px ${getOpacities(indigo.indigo9).opacity40}`,
312
+ `0 0 0 1px ${indigoDark.indigo9}, 0 0 0 3px ${getOpacities(indigoDark.indigo9).opacity40}`,
313
+ ],
314
+ // :hover
315
+ colorBgEntityBoxSelectedHover: [indigo.indigo3, indigoDark.indigo3],
316
+ //::drag
317
+ colorBgEntityBoxSelectedDrag: [indigo.indigo3, indigoDark.indigo3],
318
+ // Disabled Entity Box State (done)
319
+ opacityEntityBoxDisabled: [`${opacity.opacity65}`, `${opacity.opacity65}`],
320
+ // :hover
321
+ opacityEntityBoxDisabledHover: [`${opacity.opacity75}`, `${opacity.opacity75}`],
322
+ // :focus
323
+ opacityEntityBoxDisabledFocus: [`${opacity.opacity75}`, `${opacity.opacity75}`],
324
+ // :drag
325
+ opacityEntityBoxDisabledDrag: [`${opacity.opacity40}`, `${opacity.opacity40}`],
326
+ // Entity Old
327
+ entityCardBgColor: [whiteA.whiteA0, slateDark.slate5],
328
+ entityCardSelectedColor: [getOpacities(slate.slate2).opacity80, getOpacities(slateDark.slate6).opacity50],
329
+ entityCardHoverColor: [getOpacities(slate.slate2).opacity80, getOpacities(slateDark.slate6).opacity50],
330
+ entityCardDoneColor: [getOpacities(slate.slate4).opacity30, getOpacities(slateDark.slate5).opacity30],
331
+ entityCardShadow: [
332
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${getOpacities(slate.slate10).opacity20}`,
333
+ `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 2px 4px -4px ${getOpacities(slateDark.slate2).opacity20}`,
334
+ ],
335
+ entityCardShadowHover: [
336
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${getOpacities(slate.slate10).opacity20}`,
337
+ `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 2px 4px -4px ${getOpacities(slateDark.slate2).opacity20}`,
338
+ ],
339
+
340
+ // Main Menu Items Styles and States
341
+ // Dragged
342
+ opacityMenuItemDragged: [`${opacity.opacity40}`, `${opacity.opacity40}`],
343
+ colorBgMenuItemSelectedDragged: [indigo.indigo6, indigoDark.indigo6],
344
+ // Default
345
+ colorTextMenuItem: [slate.slate12, slateDark.slate12],
346
+ colorBgMenuItem: [transparent, transparent],
347
+ // :hover
348
+ colorBgMenuItemHover: [slate.slate4, slateDark.slate4],
349
+ // :focus
350
+ colorBgMenuItemFocus: [slate.slate6, slateDark.slate6],
351
+ // Selected
352
+ colorBgMenuItemSelected: [indigo.indigo4, indigoDark.indigo4],
353
+ // :hover
354
+ colorBgMenuItemSelectedHover: [indigo.indigo6, indigoDark.indigo6],
355
+ // :focus, :focus:hover
356
+ colorBgMenuItemSelectedFocused: [indigo.indigo6, indigoDark.indigo6],
357
+ allowedDropColor: [getOpacities(slate.slate3).opacity80, getOpacities(slateDark.slate3).opacity80],
358
+ relationViewBgColor: [slate.slate2, slateDark.slate3],
359
+ unitBg: [slate.slate3, slateDark.slate6],
360
+ unitBgHover: [slate.slate4, slateDark.slate7],
361
+ badgeBgColor: [getOpacities(slate.slate10).opacity20, getOpacities(slate.slate10).opacity20],
362
+ panelBadgeBgColor: [getOpacities(slate.slate10).opacity20, getOpacities(slate.slate10).opacity20],
363
+ tooltipBgColor: [slateDark.slate5, slateDark.slate6],
364
+ todayMarkerColor: [red.red8, redDark.red6],
365
+ viewBgOverlayColor: [getOpacities(slate.slate8).opacity20, getOpacities(slateDark.slate1).opacity60],
366
+ floatEditorMenuBg: [slate.slate1, slateDark.slate6],
367
+ floatEditorActiveColor: [indigoDark.indigo10, indigoDark.indigo11],
368
+ planBadgeBgColor: [yellow.yellow10, yellowDark.yellow10],
369
+ commentColor: [getOpacities(yellow.yellow6).opacity60, getOpacities(yellowDark.yellow9).opacity40],
370
+ cellBackgroundColor: [slate.slate2, slateDark.slate2],
371
+ cellBackgroundHoverColor: [getOpacities(slate.slate6).opacity30, getOpacities(slateDark.slate6).opacity30],
372
+ cellBorderColor: [getOpacities(slate.slate8).opacity50, getOpacities(slateDark.slate9).opacity50],
373
+ cellPinnedBorderColor: [getOpacities(slate.slate8).opacity70, getOpacities(slateDark.slate9).opacity70],
374
+ tableRowWarningColor: [getOpacities(yellow.yellow6).opacity60, getOpacities(yellowDark.yellow9).opacity40],
375
+ errorBgColor: [getOpacities(red.red9).opacity20, getOpacities(redDark.red9).opacity60],
376
+ errorTextColor: [red.red11, red.red7],
377
+ errorButtonColor: [red.red9, redDark.red10],
378
+ warningBgColor: [getOpacities(yellow.yellow6).opacity60, getOpacities(yellowDark.yellow8).opacity60],
379
+ warningButtonColor: [yellow.yellow11, yellowDark.yellow11],
380
+ infoBox: [getOpacities(yellow.yellow4).opacity50, getOpacities(yellowDark.yellow9).opacity20],
381
+ appCardBgColor: [whiteA.whiteA0, slateDark.slate2],
382
+ appCardHoverColor: [getOpacities(slate.slate1).opacity95, slateDark.slate2],
383
+ appCardShadow: [
384
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${getOpacities(slate.slate10).opacity20}`,
385
+ `0 0 0 1px ${getOpacities(slateDark.slate8).opacity50}, 0 2px 4px -4px ${getOpacities(slateDark.slate1).opacity50}`,
386
+ ],
387
+ appCardShadowHover: [
388
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 6px 8px -4px ${getOpacities(slate.slate10).opacity30}`,
389
+ `0 0 0 1px ${getOpacities(slateDark.slate8).opacity60}, 0 6px 8px -4px ${
390
+ getOpacities(slateDark.slate1).opacity100
391
+ }`,
392
+ ],
393
+ modalBg: [getOpacities(slate.slate11).opacity20, getOpacities(slateDark.slate2).opacity50],
394
+ modalContentBg: [whiteA.whiteA0, slateDark.slate3],
395
+ progressIconBg: [getOpacities(slate.slate12).opacity10, getOpacities(slateDark.slate12).opacity10],
396
+ progressIconFill: [getOpacities(slate.slate12).opacity80, getOpacities(slateDark.slate12).opacity80],
397
+ progressIconDoneBg: [getOpacities(slate.slate12).opacity80, getOpacities(slateDark.slate12).opacity90],
398
+ progressIconDoneFill: [getOpacities(slate.slate1).opacity95, getOpacities(slateDark.slate1).opacity80],
399
+ instrumentsMenuBg: [getOpacities(whiteA.whiteA0).opacity85, getOpacities(slateDark.slate4).opacity95],
400
+ instrumentsMenuShadow: [
401
+ `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${getOpacities(slate.slate10).opacity20}`,
402
+ `0px 2px 8px ${getOpacities(slate.slate2).opacity95}`,
403
+ ],
404
+ selectedColorBorder: [getOpacities(slate.slate6).opacity50, getOpacities(slate.slate6).opacity20],
405
+ formBg: [slate.slate2, slateDark.slate2],
406
+ formHeaderShadow: [
407
+ `${getOpacities(slate.slate10).opacity10} 0px 0px 6px`,
408
+ `${getOpacities(slateDark.slate1).opacity40} 0px 0px 6px`,
409
+ ],
410
+ formEditorFieldBg: [slate.slate3, slateDark.slate4],
411
+ filterGroup1Bg: [slate.slate2, slateDark.slate6],
412
+ filterGroup2Bg: [slate.slate3, slateDark.slate7],
413
+ filterGroupBorder: [blackA.blackA3, whiteA.whiteA3],
414
+ colorBgNotificationHover: [slate.slate4, slateDark.slate4],
415
+ colorBgNotificationSelected: [indigo.indigo4, indigoDark.indigo4],
416
+ colorBgNotificationSelectedHover: [indigo.indigo6, indigoDark.indigo6],
417
+ disabledInversedTextColor: [shades.opacity25, lights.opacity25],
418
+ danger: [red.red9, redDark.red10],
419
+ active: [red.red9, redDark.red10],
420
+ warning: ["#FFD41E", "#FFD41E"],
421
+ cardBg: ["#FFFFFF", slateDark.slate6],
422
+ cardSelected: ["#FFFB8F", slateDark.slate5],
423
+ cardSelectedHover: ["rgba(240, 244, 247, 0.6)", slateDark.slate5],
424
+ selectedImageBorder: [blackA.blackA8, whiteA.whiteA11],
425
+ transparent: [transparent, transparent],
426
+ shades: [lights, shades],
427
+ lights: [shades, lights],
428
+ separators: [separators, inversedSeparators],
429
+ inversedSeparators: [inversedSeparators, separators],
430
+ progressBg: [slate.slate4, slate.slate4],
431
+ progressText: [slate.slate11, slate.slate11],
432
+ progressFillBg: [slate.slate11, slate.slate11],
433
+ progressFillText: [whiteA.whiteA0, whiteA.whiteA0],
434
+ searchFiltersBg: [slate.slate1, slateDark.slate2],
435
+ colorPickerSwatchBorder: [blackA.blackA7, blackA.blackA7],
436
+ richTextTableBorder: [blackA.blackA5, whiteA.whiteA7],
437
+ gridHeaderBgColor: [slate.slate2, slateDark.slate3],
438
+ gridHeaderHoverBgColor: [slate.slate3, slateDark.slate4],
439
+ gridHeaderTextColor: [slate.slate9, slateDark.slate10],
440
+ gridCellBgColor: [whiteA.whiteA0, slateDark.slate2],
441
+ gridCellBorderColor: [slate.slate5, slateDark.slate6],
442
+ gridPinnedCellBorderColor: [slate.slate8, slateDark.slate8],
443
+ gridDisabledCellBgColor: [slate.slate2, slateDark.slate3],
444
+ gridSelectedCellBgColor: [indigo.indigo3, indigoDark.indigo3],
445
+ gridHighlightedCellBgColor: [indigo.indigo4, indigoDark.indigo5],
446
+ gridSelectedCellBorderColor: [indigo.indigo6, indigoDark.indigo7],
447
+ gridSelectedPinnedCellBorderColor: [indigo.indigo7, indigoDark.indigo7],
448
+ gridDisabledSelectedCellBgColor: [indigo.indigo4, indigoDark.indigo5],
449
+ gridActiveCellBorderColor: [indigo.indigo8, indigoDark.indigo9],
450
+ colorBgReactionsDefault: [slate.slate3, slateDark.slate6],
451
+ colorBgReactionsHover: [slate.slate1, slateDark.slate2],
452
+ colorBorderReactionsHover: [slate.slate8, slateDark.slate9],
453
+ colorBgReactionsSelectedDefault: [indigo.indigo3, indigoDark.indigo8],
454
+ colorBorderReactionsSelectedDefault: [indigo.indigo8, indigoDark.indigo8],
455
+ colorBgReactionsSelectedHover: [indigo.indigo2, indigo.indigo10],
456
+ colorBorderReactionsSelectedHover: [indigo.indigo9, indigo.indigo10],
457
+ colorTextReactionsSelected: [indigo.indigo10, slateDark.slate12],
458
+ colorBgToastDefault: [slate.slate1, slateDark.slate1],
459
+ } as const;
460
+
461
+ type ThemeDefs = typeof themeColors;
462
+
463
+ type GetThemeColors<idx extends number> = {
464
+ [k in keyof ThemeDefs]: ThemeDefs[k][idx];
465
+ };
466
+
467
+ type LightColors = GetThemeColors<0>;
468
+ type DarkColors = GetThemeColors<1>;
469
+
470
+ const lightColors = Object.fromEntries(
471
+ Object.entries(themeColors).map(([key, value]) => {
472
+ return [key, value[0]];
473
+ })
474
+ ) as LightColors;
475
+
476
+ const light2Colors = {
477
+ ...lightColors,
478
+ mode: "light2",
479
+ } as const;
480
+
481
+ const darkColors = Object.fromEntries(
482
+ Object.entries(themeColors).map(([key, value]) => {
483
+ return [key, value[1]];
484
+ })
485
+ ) as DarkColors;
486
+
487
+ export function getLightColors() {
488
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
489
+ // @ts-ignore
490
+ if (process.env.NODE_ENV !== "test") {
491
+ throw new Error("Only for test purpose");
492
+ }
493
+ return lightColors;
494
+ }
495
+
496
+ export function getDarkColors() {
497
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
498
+ // @ts-ignore
499
+ if (process.env.NODE_ENV !== "test") {
500
+ throw new Error("Only for test purpose");
501
+ }
502
+ return darkColors;
503
+ }
504
+
505
+ export function getLight2Colors() {
506
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
507
+ // @ts-ignore
508
+ if (process.env.NODE_ENV !== "test") {
509
+ throw new Error("Only for test purpose");
510
+ }
511
+ return light2Colors;
512
+ }
513
+
514
+ const getDefaultTheme = (): never => {
515
+ throw Error("Please specify theme mode");
516
+ };
517
+
518
+ export function getThemeValue<T>(theme: ThemeMode, values: {light: T; light2?: T; dark: T}): T {
519
+ if (theme in values) {
520
+ return values[theme] as T;
521
+ }
522
+ return values.light;
523
+ }
524
+
525
+ function getTypeColors(themeColor: string, theme: ThemeMode) {
526
+ let color;
527
+ // switch to chroma.valid once we start using 2.0.1
528
+ try {
529
+ chroma(themeColor);
530
+ color = themeColor;
531
+ } catch (e) {
532
+ color = brandColors.green;
533
+ }
534
+ const boardBg = chroma(color).luminance(0.85).desaturate(0.2).set("hsl.h", "+2");
535
+
536
+ const lightTypeColors = {
537
+ primary: color,
538
+ opacity: getOpacities(color),
539
+ darkenPrimary: getDarkenColor(color),
540
+ brightenPrimary: chroma(color).luminance(0.92).desaturate(0.1).alpha(0.98).css(),
541
+ boardBg: boardBg.hex(),
542
+ boardBgOverlay: boardBg.alpha(0.8).css(),
543
+ headerBg: chroma(color).luminance(0.7).desaturate(0.5).set("hsl.h", "+2").css(),
544
+ detailsBg: chroma(color).alpha(0.5).luminance(0.85).hex(),
545
+ focus: chroma(color).alpha(0.25).css(),
546
+ separator: chroma(color).alpha(0.3).css(),
547
+ };
548
+
549
+ const darkTypeColors = {
550
+ primary: color,
551
+ opacity: getOpacities(color),
552
+ darkenPrimary: getDarkenColor(color),
553
+ brightenPrimary: chroma(color).luminance(0.92).desaturate(0.1).alpha(0.98).css(),
554
+ boardBg: boardBg.hex(),
555
+ boardBgOverlay: boardBg.alpha(0.8).css(),
556
+ headerBg: chroma(color).luminance(0.7).desaturate(0.5).set("hsl.h", "+2").css(),
557
+ detailsBg: chroma(color).alpha(0.03).luminance(0.8).desaturate(0.8).darken(0.1).hex(),
558
+ focus: chroma(color).alpha(0.25).css(),
559
+ separator: chroma(color).alpha(0.3).css(),
560
+ };
561
+
562
+ switch (theme) {
563
+ case "light":
564
+ return lightTypeColors;
565
+ case "dark":
566
+ return darkTypeColors;
567
+ case "light2":
568
+ return lightTypeColors;
569
+ default:
570
+ return lightTypeColors;
571
+ }
572
+ }
573
+
574
+ type DesignColor = typeof darkColors | typeof lightColors | typeof light2Colors;
575
+
576
+ export type ThemeColors = ReturnType<typeof getTypeColors> & DesignColor;
577
+
578
+ const colorsByTheme: Record<string, DesignColor> = {
579
+ dark: darkColors,
580
+ light: lightColors,
581
+ light2: light2Colors,
582
+ };
583
+
584
+ export const getThemeColors: (themeColor: string, theme: ThemeMode) => ThemeColors = _.memoize(
585
+ (themeColor: string, theme: ThemeMode = getDefaultTheme()): ThemeColors => {
586
+ const colors = colorsByTheme[theme];
587
+ return {
588
+ ...getTypeColors(themeColor, theme),
589
+ ...colors,
590
+ };
591
+ },
592
+ (themeColor, theme) => themeColor + theme
593
+ );
594
+
595
+ export const getTextColor = _.memoize((color: string): string => {
596
+ return makeChromaColor(color).hex();
597
+ });
598
+
599
+ export const getLinkedHighlightBackgroundColor = _.memoize(
600
+ (themeColors: ThemeColors, color: string): string => {
601
+ switch (themeColors.mode) {
602
+ case "dark":
603
+ return makeChromaColor(color).alpha(0.4).luminance(0.5).css();
604
+ case "light":
605
+ return makeChromaColor(color).alpha(0.3).luminance(0.6).css();
606
+ default:
607
+ return makeChromaColor(color).alpha(0.3).luminance(0.6).css();
608
+ }
609
+ },
610
+ (themeMode, color) => `${themeMode}-${color}`
611
+ );
612
+
613
+ export const getEnumBackgroundColor = _.memoize(
614
+ (mode: ThemeMode, color: string) => {
615
+ return getThemeValue(mode, {
616
+ light: a11yColor(getOpacities(color).opacity20, lightColors.whiteColor, 1),
617
+ dark: a11yColor(getOpacities(color).opacity30, darkColors.menuBg, 1.3),
618
+ });
619
+ },
620
+ (themeMode, color) => `${themeMode}-${color}`
621
+ );
622
+
623
+ // TODO: fix color for light2. It should same as 'dark' only on dark menu but same as 'light' on other parts of application
624
+ export const getAppIconBackgroundColor = (mode: ThemeMode, color: string) =>
625
+ getThemeValue(mode, {
626
+ dark: a11yColor(getOpacities(color).opacity30, darkColors.menuBg, 1.3),
627
+ light: a11yColor(getOpacities(color).opacity15, lightColors.whiteColor, 1),
628
+ light2: a11yColor(getOpacities(color).opacity30, darkColors.menuBg, 1.3),
629
+ });
630
+
631
+ export const getIconColor = _.memoize(
632
+ (mode: ThemeMode, color: string) =>
633
+ getThemeValue(mode, {
634
+ light: a11yColor(getOpacities(color).opacity95, lightColors.whiteColor, 3),
635
+ dark: a11yColor(getOpacities(color).opacity95, darkColors.menuBg, 5),
636
+ }),
637
+ (themeMode, color) => `${themeMode}-${color}`
638
+ );
639
+
640
+ export const cardTypeColors = [
641
+ "#4A4A4A",
642
+ "#6A849B",
643
+ "#BEC5CC",
644
+ "#D40915",
645
+ "#E72065",
646
+ "#9C2BAF",
647
+ "#673DB6",
648
+ "#3E53B4",
649
+ "#2978FB",
650
+ "#199EE3",
651
+ "#1FBED3",
652
+ "#159789",
653
+ "#4FAF54",
654
+ "#8EC351",
655
+ "#FBA32F",
656
+ "#FC551F",
657
+ "#B04E31",
658
+ ] as const;
659
+
660
+ export const dropCursorColor = chroma(brandColors.blue).alpha(0.7).css();
661
+ export const colors = {
662
+ ...getTypeColors(brandColors.green, "light"),
663
+ brandColors,
664
+ stateColors,
665
+ transparent,
666
+ shades,
667
+ lights,
668
+ inversedTextColor: "#FFFFFF",
669
+ disabledInversedTextColor: lights.opacity25,
670
+ } as const;
671
+
672
+ export const space = {
673
+ xxs: 2, // Not recommended
674
+ xs: 4,
675
+ s: 6,
676
+ m: 8,
677
+ l: 12,
678
+ xl: 24,
679
+ xxl: 48, // Not recommended
680
+ } as const;
681
+ /** Token for nested items spacing in nested trees */
682
+ export const spaceNestedTreeLevel = 40;
683
+ export const spaceNestedTreeInterval = 0;
684
+ export const layout = {
685
+ logoSize: 24,
686
+ menuDefaultWidth: 243,
687
+ menuMinWidth: 46, //TODO: make dependency to itemHeight
688
+ menuMaxWidth: 480,
689
+ menuItemMinWidth: 80,
690
+ menuGroupHeaderIndent: 40, // I'm ok
691
+ menuItemLevelIndent: 24,
692
+ listItemHeight: 38,
693
+ itemHeight: 36,
694
+ itemWithSubtitleHeight: 52,
695
+ groupTitleHeight: 30,
696
+ menuItemHeight: 32,
697
+ newMenuItemHeight: 30, // I'm ok
698
+ viewHeaderHeight: space.l * 7,
699
+ viewHeaderCompactHeight: 52,
700
+ columnMinWidth: 240,
701
+ columnWidths: {compact: 200, default: 240, list: 280, full: 320},
702
+ objectEditorMinWidth: 480,
703
+ typeEditorWidth: "30vw",
704
+ typeEditorMinWidth: 480,
705
+ viewSetupWidth: "30vw",
706
+ viewSetupMinWidth: 525,
707
+ inputHeight: 36, //TODO: merge input and item height?
708
+ timelineLineHeight: 46,
709
+ timelineGroupPadding: 6,
710
+ timelineItemHeightRatio: 34 / 40,
711
+ timelineHeaderHeight: 30,
712
+ calendarEventHeight: 30,
713
+ calendarHeaderHeight: 30,
714
+ calendarToolbarHeight: 60,
715
+ checkboxSize: 17,
716
+ fakeBoardWidth: 260,
717
+ fakeBoardHeight: 160,
718
+ inlineInputHeight: 32,
719
+ menuHeight: 32,
720
+ popupTopMargin: 48,
721
+ unitHeight: 18,
722
+ } as const;
723
+
724
+ export const radius = 3;
725
+
726
+ export const border = {
727
+ radius0: 0,
728
+ radius1: 1,
729
+ radius2: 2,
730
+ radius4: 4,
731
+ radius6: 6,
732
+ radius8: 8,
733
+ radius10: 10,
734
+ radius12: 12,
735
+ } as const;
736
+
737
+ export const lineHeight = {
738
+ text: 1.6,
739
+ regular: 1.5,
740
+ heading: 1.25,
741
+ nowrap: 1,
742
+ } as const;
743
+
744
+ export const tooltipDelay = {
745
+ enter: 500,
746
+ leave: 0,
747
+ } as const;
748
+
749
+ export const duration = 120;
750
+ export const easing = "ease-in-out";
751
+ export const transition = `${duration}ms ${easing}`;
752
+
753
+ export const iconSize = 20;
754
+ export const viewBoxSize = "0 0 20 20";
755
+ export const avatarSize = 24;
756
+
757
+ export const shadows = {
758
+ border: `0 0 0 1px ${shades.opacity10}`,
759
+ inversedBorder: `0 0 0 1px ${lights.opacity10}`,
760
+ videoPreview: "0 4px 30px 4px rgba(0, 0, 0, .15)",
761
+ } as const;
762
+
763
+ export const dateFormat = "MMM D, YYYY";
764
+ export const dateTimeFormat = "MMM D, YYYY HH:mm";
765
+ export const timeFormat = "HH:mm";
766
+
767
+ export const getLinearGradient = (backgroundColors: Array<string>): string => {
768
+ const parts = _.flatMap(
769
+ backgroundColors.map((color, index, arr) => [
770
+ `${color} ${(index / arr.length) * 100}%`,
771
+ `${color} ${((index + 1) / arr.length) * 100}%`,
772
+ ])
773
+ );
774
+ return `linear-gradient(to bottom, ${parts.join(", ")})`;
775
+ };
776
+
777
+ export const getObjectColorMemoized = _.memoize((name) => {
778
+ if (!name) {
779
+ return "#999999";
780
+ }
781
+ const colorHash = new ColorHash({
782
+ lightness: [0.5, 0.6, 0.7],
783
+ saturation: [0.6, 0.7, 0.8, 0.9, 1],
784
+ });
785
+ return colorHash.hex(name);
786
+ });
787
+
788
+ export const themeVars = Object.keys(getThemeColors(brandColors.green, "light")).reduce((vars, key) => {
789
+ if (key === "opacity") {
790
+ vars[key] = Object.fromEntries(
791
+ Object.keys(opacity).map((opacityKey) => [opacityKey, `var(--${varPrefix}-opacity-${opacityKey})`])
792
+ );
793
+ } else if (key === "stateColors") {
794
+ vars[key] = Object.fromEntries(
795
+ Object.keys(stateColors).map((stateColorKey) => [
796
+ stateColorKey,
797
+ `var(--${varPrefix}-state-colors-${stateColorKey})`,
798
+ ])
799
+ );
800
+ } else if (key === "brandColors") {
801
+ vars[key] = Object.fromEntries(
802
+ Object.keys(brandColors).map((brandColorKey) => [
803
+ brandColorKey,
804
+ `var(--${varPrefix}-brand-colors-${brandColorKey})`,
805
+ ])
806
+ );
807
+ } else if (key === "shades") {
808
+ vars[key] = Object.fromEntries(
809
+ Object.keys(shades).map((shadeKey) => [shadeKey, `var(--${varPrefix}-shades-${shadeKey})`])
810
+ );
811
+ } else if (key === "lights") {
812
+ vars[key] = Object.fromEntries(
813
+ Object.keys(lights).map((lightKey) => [lightKey, `var(--${varPrefix}-lights-${lightKey})`])
814
+ );
815
+ } else if (key === "separators") {
816
+ vars[key] = Object.fromEntries(
817
+ Object.keys(separators).map((separatorKey) => [separatorKey, `var(--${varPrefix}-separator-${separatorKey})`])
818
+ );
819
+ } else if (key === "inversedSeparators") {
820
+ vars[key] = Object.fromEntries(
821
+ Object.keys(inversedSeparators).map((separatorKey) => [
822
+ separatorKey,
823
+ `var(--${varPrefix}-inversed-separator-${separatorKey})`,
824
+ ])
825
+ );
826
+ } else {
827
+ vars[key] = `var(--${varPrefix}-color-${key})`;
828
+ }
829
+ return vars;
830
+ }, {} as Record<string, string | {[k: string]: string}>) as ThemeColors;
831
+
832
+ const DEFAULT_REJECT_KEYS = Object.keys(lightColors);
833
+ export const createInlineTheme = _.memoize(
834
+ (theme: ThemeColors, rejectKeys = DEFAULT_REJECT_KEYS) => {
835
+ return createInlineStyles<ThemeColors>(theme, rejectKeys);
836
+ },
837
+ (theme, rejectKeys = DEFAULT_REJECT_KEYS) => {
838
+ const rejectKeysLabel = rejectKeys === DEFAULT_REJECT_KEYS ? "DEFAULT_REJECT_KEYS" : JSON.stringify(rejectKeys);
839
+ return `${theme.mode}__${theme.primary}__${rejectKeysLabel}`;
840
+ }
841
+ );
842
+
843
+ export const textStyles = {
844
+ heading1: {
845
+ fontFamily,
846
+ fontSize: typeSizes[0],
847
+ letterSpacing: "-0.003em",
848
+ lineHeight: lineHeight.heading,
849
+ fontWeight: fontWeight.medium,
850
+ color: themeVars.textColor,
851
+ },
852
+ heading2: {
853
+ fontFamily,
854
+ fontSize: typeSizes[1],
855
+ letterSpacing: "-0.002em",
856
+ lineHeight: lineHeight.heading,
857
+ fontWeight: fontWeight.medium,
858
+ color: themeVars.textColor,
859
+ },
860
+ heading3: {
861
+ fontFamily,
862
+ fontSize: typeSizes[2],
863
+ letterSpacing: "-0.002em",
864
+ lineHeight: lineHeight.heading,
865
+ fontWeight: fontWeight.medium,
866
+ color: themeVars.textColor,
867
+ },
868
+ heading4: {
869
+ fontFamily,
870
+ fontSize: typeSizes[3],
871
+ lineHeight: lineHeight.heading,
872
+ fontWeight: fontWeight.medium,
873
+ color: themeVars.textColor,
874
+ },
875
+ heading5: {
876
+ fontFamily,
877
+ fontSize: typeSizes[4],
878
+ lineHeight: lineHeight.heading,
879
+ fontWeight: fontWeight.medium,
880
+ color: themeVars.textColor,
881
+ },
882
+ heading6: {
883
+ fontFamily,
884
+ fontSize: typeSizes[5],
885
+ lineHeight: lineHeight.heading,
886
+ letterSpacing: 0.6,
887
+ textTransform: "uppercase",
888
+ fontWeight: fontWeight.regular,
889
+ color: themeVars.textColor,
890
+ },
891
+ heading7: {
892
+ fontFamily,
893
+ fontSize: typeSizes[6],
894
+ lineHeight: lineHeight.heading,
895
+ letterSpacing: 0.6,
896
+ textTransform: "uppercase",
897
+ fontWeight: fontWeight.regular,
898
+ color: themeVars.textColor,
899
+ },
900
+ big: {
901
+ fontFamily,
902
+ fontSize: typeSizes[3],
903
+ lineHeight: lineHeight.regular,
904
+ fontWeight: fontWeight.regular,
905
+ color: themeVars.textColor,
906
+ },
907
+ regular: {
908
+ fontFamily,
909
+ fontSize: typeSizes[4],
910
+ lineHeight: lineHeight.regular,
911
+ fontWeight: fontWeight.regular,
912
+ color: themeVars.textColor,
913
+ textTransform: "none",
914
+ letterSpacing: "normal",
915
+ },
916
+ small: {
917
+ fontFamily,
918
+ fontSize: typeSizes[5],
919
+ lineHeight: lineHeight.regular,
920
+ fontWeight: fontWeight.regular,
921
+ color: themeVars.textColor,
922
+ textTransform: "none",
923
+ },
924
+ code: {
925
+ fontFamily: '"SFMono-Regular", Menlo, Consolas, "PT Mono", "Liberation Mono", Courier, monospace',
926
+ fontSize: typeSizes[4],
927
+ lineHeight: lineHeight.regular,
928
+ fontWeight: fontWeight.regular,
929
+ color: themeVars.textColor,
930
+ },
931
+ link: {
932
+ color: themeVars.linkColor,
933
+ borderBottom: themeVars.linkBorder,
934
+ textDecoration: "none",
935
+ cursor: "pointer",
936
+ transition: `border ${transition}`,
937
+ },
938
+ inversedLink: {
939
+ color: colors.inversedTextColor,
940
+ cursor: "pointer",
941
+ textDecoration: "underline",
942
+ textDecorationColor: lights.opacity25,
943
+ },
944
+ note: {
945
+ fontFamily,
946
+ fontSize: typeSizes[3],
947
+ lineHeight: lineHeight.regular,
948
+ fontWeight: fontWeight.regular,
949
+ color: themeVars.textColor,
950
+ borderRadius: radius,
951
+ },
952
+ important: {
953
+ fontFamily,
954
+ fontSize: typeSizes[3],
955
+ lineHeight: lineHeight.regular,
956
+ fontWeight: fontWeight.regular,
957
+ color: themeVars.textColor,
958
+ border: `1px solid ${themeVars.active}`,
959
+ borderRadius: radius,
960
+ },
961
+ } as const;