@fibery/ui-kit 1.0.4 → 1.1.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 (39) hide show
  1. package/package.json +9 -3
  2. package/src/Button.d.ts +3 -1
  3. package/src/Button.js +10 -12
  4. package/src/Pallete.ts +16 -16
  5. package/src/Select/components.tsx +5 -9
  6. package/src/Select/styles.ts +14 -4
  7. package/src/ThemeProvider.tsx +131 -5
  8. package/src/antd/styles.ts +4 -4
  9. package/src/designSystem.ts +165 -193
  10. package/src/error-alert.tsx +55 -0
  11. package/src/icons/Icon.tsx +2 -2
  12. package/src/icons/ast/AppStoreOneColor.ts +1 -1
  13. package/src/icons/ast/Checked.ts +1 -1
  14. package/src/icons/ast/Email.ts +8 -0
  15. package/src/icons/ast/ExtensionAvatar.ts +1 -1
  16. package/src/icons/ast/Integration.ts +1 -1
  17. package/src/icons/ast/RicheditorImageAlignCenter.ts +1 -1
  18. package/src/icons/ast/RicheditorImageAlignLeft.ts +1 -1
  19. package/src/icons/ast/RicheditorImageAlignRight.ts +1 -1
  20. package/src/icons/ast/RicheditorImageUpload.ts +1 -1
  21. package/src/icons/ast/RicheditorImageWrapCenter.ts +1 -1
  22. package/src/icons/ast/RicheditorImageWrapLeft.ts +1 -1
  23. package/src/icons/ast/RicheditorImageWrapRight.ts +1 -1
  24. package/src/icons/ast/SidebarFields.ts +8 -0
  25. package/src/icons/ast/SidebarFieldsOpened.ts +8 -0
  26. package/src/icons/ast/SlackIcon.ts +8 -0
  27. package/src/icons/ast/SlideMenu.ts +8 -0
  28. package/src/icons/ast/SlideMenuOpened.ts +8 -0
  29. package/src/icons/ast/index.tsx +6 -0
  30. package/src/icons/react/Email.tsx +12 -0
  31. package/src/icons/react/SidebarFields.tsx +12 -0
  32. package/src/icons/react/SidebarFieldsOpened.tsx +12 -0
  33. package/src/icons/react/SlackIcon.tsx +12 -0
  34. package/src/icons/react/SlideMenu.tsx +12 -0
  35. package/src/icons/react/SlideMenuOpened.tsx +12 -0
  36. package/src/icons/react/index.tsx +6 -0
  37. package/src/loading-sausage.tsx +1 -1
  38. package/src/media-query-utils.ts +24 -0
  39. package/src/theme-settings.ts +164 -0
@@ -1,7 +1,22 @@
1
1
  /* eslint-disable max-lines */
2
2
  import chroma from "chroma-js";
3
+ import {ThemeMode} from "./theme-settings";
3
4
  import ColorHash from "color-hash";
4
- import {blackA, indigo, indigoDark, red, redDark, sage, slate, slateDark, whiteA, yellow, yellowDark} from "./Pallete";
5
+ import {
6
+ blackA,
7
+ indigo,
8
+ indigoDark,
9
+ red,
10
+ blue,
11
+ blueDark,
12
+ redDark,
13
+ sage,
14
+ slate,
15
+ slateDark,
16
+ whiteA,
17
+ yellow,
18
+ yellowDark,
19
+ } from "./Pallete";
5
20
  import _ from "lodash";
6
21
  import {createInlineTheme as createInlineStyles} from "./create-inline-theme";
7
22
 
@@ -114,18 +129,22 @@ const lightColors = {
114
129
  pageBg: whiteA.whiteA0,
115
130
  pageContentBg: whiteA.whiteA0,
116
131
  sidebarBg: whiteA.whiteA0,
117
- sidebarShadow: `-3px 0px 10px 0px ${getOpacities(sage.sage2).opacity80}`,
132
+ sidebarShadow: `-3px 0px 10px 0px ${getOpacities(slate.slate10).opacity10}`,
118
133
  menuBg: sage.sage3,
119
134
  menuFooterColor: getOpacities(whiteA.whiteA0).opacity20,
120
135
  menuFooterHoverColor: getOpacities(whiteA.whiteA0).opacity40,
121
136
  textColor: slateDark.slate3,
137
+ textSelectionColor: getOpacities(blue.blue10).opacity20,
122
138
  accentTextColor: slate.slate10,
123
139
  disabledTextColor: slate.slate9,
124
- inversedTextColor: slateDark.slate3,
140
+ inversedTextColor: slate.slate3,
125
141
  linkColor: indigoDark.indigo10,
126
142
  linkBorder: `1px solid ${getOpacities(indigoDark.indigo10).opacity20}`,
127
143
  linkHoverColor: indigo.indigo10,
128
144
  linkBorderHover: `1px solid ${getOpacities(indigo.indigo10).opacity80}`,
145
+ codeColor: red.red9,
146
+ codeBgColor: makeChromaColor("#F24461").luminance(0.92).css(),
147
+ codeBlockBgColor: sage.sage3,
129
148
  entityNodeColor: slateDark.slate3,
130
149
  entityNodeBorder: `1px solid ${getOpacities(slateDark.slate3).opacity30}`,
131
150
  entityNodeHoverColor: slateDark.slate7,
@@ -135,11 +154,14 @@ const lightColors = {
135
154
  shortcutBorderColor: `1px solid ${getOpacities(slate.slate8).opacity20}`,
136
155
  inputBgColor: whiteA.whiteA0,
137
156
  inputDisabledBgColor: slate.slate2,
157
+ inputDisabledBorderColor: `0 0 0 1px ${getOpacities(slate.slate6).opacity20}`,
138
158
  inputCopyBgColor: slate.slate3,
139
159
  inputBorderColor: `0 0 0 1px ${getOpacities(slate.slate6).opacity70}`,
140
160
  inputBorderHoverColor: `0 0 0 1px ${getOpacities(slate.slate6).opacity100}`,
141
161
  inputPlaceholderTextColor: slate.slate10,
142
162
  buttonColor: slate.slate10,
163
+ buttonPrimaryTextColor: slate.slate2,
164
+ checkboxColor: slate.slate10,
143
165
  menuTextColor: slate.slate12,
144
166
  selectedMenuTextColor: slate.slate2,
145
167
  actionMenuBg: whiteA.whiteA0,
@@ -151,6 +173,12 @@ const lightColors = {
151
173
  actionMenuInnerHover: slate.slate3,
152
174
  actionMenuButtonColor: whiteA.whiteA0,
153
175
  actionMenuButtonHoverColor: slate.slate1,
176
+ actionMenuButtonShadow: `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${
177
+ getOpacities(slate.slate10).opacity20
178
+ }`,
179
+ actionMenuButtonShadowHover: `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 6px 8px -4px ${
180
+ getOpacities(slate.slate10).opacity30
181
+ }`,
154
182
  separatorColor: getOpacities(slate.slate4).opacity50,
155
183
  iconColor: slate.slate10,
156
184
  menuIconColor: getOpacities(slate.slate10).opacity90,
@@ -164,8 +192,8 @@ const lightColors = {
164
192
  entityCardShadow: `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${
165
193
  getOpacities(slate.slate10).opacity20
166
194
  }`,
167
- entityCardShadowHover: `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 6px 8px -4px ${
168
- getOpacities(slate.slate10).opacity30
195
+ entityCardShadowHover: `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${
196
+ getOpacities(slate.slate10).opacity20
169
197
  }`,
170
198
  unitBg: slate.slate3,
171
199
  unitBgHover: slate.slate4,
@@ -178,8 +206,10 @@ const lightColors = {
178
206
  commentColor: getOpacities(yellow.yellow6).opacity60,
179
207
  cellBorderColor: getOpacities(slate.slate8).opacity50,
180
208
  tableRowWarningColor: getOpacities(yellow.yellow6).opacity60,
181
- warningBgColor: yellow.yellow6,
209
+ errorBgColor: getOpacities(red.red9).opacity60,
210
+ warningBgColor: getOpacities(yellow.yellow6).opacity60,
182
211
  warningButtonColor: yellow.yellow11,
212
+ infoBox: getOpacities(yellow.yellow4).opacity50,
183
213
  appCardBgColor: whiteA.whiteA0,
184
214
  appCardHoverColor: getOpacities(slate.slate1).opacity95,
185
215
  appCardShadow: `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${
@@ -189,23 +219,26 @@ const lightColors = {
189
219
  getOpacities(slate.slate10).opacity30
190
220
  }`,
191
221
  modalBg: getOpacities(slate.slate11).opacity20,
222
+ modalShadow: `${getOpacities(slate.slate10).opacity10} 0px 16px 70px`,
223
+ modalContentBg: whiteA.whiteA0,
224
+ progressIconBg: getOpacities(slate.slate12).opacity10,
225
+ progressIconFill: getOpacities(slate.slate12).opacity80,
226
+ progressIconDoneBg: getOpacities(slate.slate12).opacity80,
227
+ progressIconDoneFill: getOpacities(slate.slate1).opacity95,
228
+ instrumentsMenuBg: getOpacities(whiteA.whiteA0).opacity85,
229
+ instrumentsMenuShadow: `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${
230
+ getOpacities(slate.slate10).opacity20
231
+ }`,
232
+ selectedColorBorder: getOpacities(slate.slate6).opacity50,
192
233
  //end
193
234
  placeholderTextColor: "#65788B",
194
235
  disabledInversedTextColor: shades.light,
195
- codeColor: "#F24461",
196
- codeBgColor: makeChromaColor("#F24461").luminance(0.88).desaturate(0.1).css(),
197
236
  danger: brandColors.red,
198
237
  active: brandColors.red,
199
238
  warning: "#FFD41E",
200
239
  cardBg: "#FFFFFF",
201
240
  cardSelected: "#FFFB8F",
202
241
  cardSelectedHover: "rgba(240, 244, 247, 0.6)",
203
- menuSelected: "rgba(240, 244, 247, 1)",
204
- menuSelectedHover: "rgba(240, 244, 247, 1)",
205
- menuBg1: "hsl(151, 10.6%, 95.2%)",
206
- menuBg2: "rgba(255, 255, 255, 0.1)",
207
- menuBg3: "rgba(255, 255, 255, 0.3)",
208
- infoBox: "rgba(255, 212, 0, 0.2)",
209
242
  errorBg: "rgba(255, 241, 240, 1)",
210
243
  timelineCard: "#FCE07D",
211
244
  transparent,
@@ -215,6 +248,22 @@ const lightColors = {
215
248
  inversedSeparators,
216
249
  } as const;
217
250
 
251
+ const darkMenu = {
252
+ menuBg: slateDark.slate2,
253
+ menuFooterColor: getOpacities(slateDark.slate3).opacity20,
254
+ menuFooterHoverColor: getOpacities(slateDark.slate3).opacity40,
255
+ menuTextColor: slate.slate8,
256
+ menuIconColor: getOpacities(slate.slate10).opacity90,
257
+ selectedMenuIconColor: getOpacities(slate.slate1).opacity90,
258
+ selectedMenuTextColor: slate.slate2,
259
+ };
260
+
261
+ const light2Colors = {
262
+ ...lightColors,
263
+ ...darkMenu,
264
+ mode: "light2",
265
+ } as const;
266
+
218
267
  const darkColors = {
219
268
  mode: "dark",
220
269
  brandColors,
@@ -227,19 +276,20 @@ const darkColors = {
227
276
  panelContentBg: slateDark.slate2,
228
277
  pageBg: slateDark.slate1,
229
278
  pageContentBg: slateDark.slate2,
230
- sidebarBg: slateDark.slate2,
279
+ sidebarBg: slateDark.slate3,
231
280
  sidebarShadow: `-3px 0px 10px 0px ${getOpacities(slateDark.slate1).opacity80}`,
232
- menuBg: slateDark.slate2,
233
- menuFooterColor: getOpacities(slateDark.slate3).opacity20,
234
- menuFooterHoverColor: getOpacities(slateDark.slate3).opacity40,
235
281
  textColor: slate.slate6,
282
+ textSelectionColor: getOpacities(blueDark.blue10).opacity40,
236
283
  accentTextColor: slate.slate10,
237
284
  disabledTextColor: slateDark.slate9,
238
- inversedTextColor: slate.slate6,
285
+ inversedTextColor: slateDark.slate6,
239
286
  linkColor: indigoDark.indigo11,
240
287
  linkBorder: `1px solid ${getOpacities(indigoDark.indigo11).opacity40}`,
241
288
  linkHoverColor: indigoDark.indigo10,
242
289
  linkBorderHover: `1px solid ${getOpacities(indigoDark.indigo10).opacity80}`,
290
+ codeColor: red.red8,
291
+ codeBgColor: makeChromaColor(redDark.red3).luminance(0.05).darken(0.5).css(),
292
+ codeBlockBgColor: slateDark.slate3,
243
293
  entityNodeColor: slate.slate8,
244
294
  entityNodeBorder: `1px solid ${getOpacities(slate.slate8).opacity40}`,
245
295
  entityNodeHoverColor: slate.slate7,
@@ -249,13 +299,14 @@ const darkColors = {
249
299
  shortcutBorderColor: `1px solid ${getOpacities(slateDark.slate10).opacity20}`,
250
300
  inputBgColor: slateDark.slate2,
251
301
  inputDisabledBgColor: slateDark.slate3,
302
+ inputDisabledBorderColor: `0 0 0 1px ${getOpacities(slateDark.slate8).opacity20}`,
252
303
  inputCopyBgColor: slateDark.slate4,
253
304
  inputBorderColor: `0 0 0 1px ${getOpacities(slateDark.slate8).opacity70}`,
254
305
  inputBorderHoverColor: `0 0 0 1px ${getOpacities(slateDark.slate8).opacity70}`,
255
306
  inputPlaceholderTextColor: slate.slate10,
256
- buttonColor: slate.slate10,
257
- menuTextColor: slate.slate8,
258
- selectedMenuTextColor: slate.slate2,
307
+ buttonColor: slateDark.slate10,
308
+ buttonPrimaryTextColor: slate.slate6,
309
+ checkboxColor: slateDark.slate10,
259
310
  actionMenuBg: slateDark.slate4,
260
311
  actionMenuInnerBg: slateDark.slate5,
261
312
  actionMenuShadow: `0 0 0 1px ${getOpacities(slateDark.slate1).opacity10}, 0 12px 16px -4px ${
@@ -265,10 +316,14 @@ const darkColors = {
265
316
  actionMenuInnerHover: getOpacities(slateDark.slate7).opacity50,
266
317
  actionMenuButtonColor: slateDark.slate2,
267
318
  actionMenuButtonHoverColor: slateDark.slate3,
319
+ actionMenuButtonShadow: `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 2px 4px -4px ${
320
+ getOpacities(slateDark.slate2).opacity20
321
+ }`,
322
+ actionMenuButtonShadowHover: `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 6px 8px -4px ${
323
+ getOpacities(slateDark.slate2).opacity30
324
+ }`,
268
325
  separatorColor: getOpacities(slateDark.slate8).opacity50,
269
326
  iconColor: slate.slate9,
270
- menuIconColor: getOpacities(slate.slate10).opacity90,
271
- selectedMenuIconColor: getOpacities(slate.slate1).opacity90,
272
327
  appIconColor: getOpacities(slate.slate2).opacity70,
273
328
  mentionBgColor: slateDark.slate5,
274
329
  entityCardBgColor: slateDark.slate4,
@@ -278,8 +333,8 @@ const darkColors = {
278
333
  entityCardShadow: `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 2px 4px -4px ${
279
334
  getOpacities(slateDark.slate2).opacity20
280
335
  }`,
281
- entityCardShadowHover: `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 6px 8px -4px ${
282
- getOpacities(slateDark.slate2).opacity30
336
+ entityCardShadowHover: `0 0 0 1px ${getOpacities(slateDark.slate2).opacity10}, 0 2px 4px -4px ${
337
+ getOpacities(slateDark.slate2).opacity20
283
338
  }`,
284
339
  unitBg: slateDark.slate6,
285
340
  unitBgHover: slateDark.slate7,
@@ -292,8 +347,10 @@ const darkColors = {
292
347
  commentColor: getOpacities(yellowDark.yellow9).opacity40,
293
348
  cellBorderColor: getOpacities(slateDark.slate9).opacity50,
294
349
  tableRowWarningColor: getOpacities(yellowDark.yellow9).opacity40,
295
- warningBgColor: getOpacities(yellowDark.yellow9).opacity40,
350
+ errorBgColor: getOpacities(redDark.red9).opacity60,
351
+ warningBgColor: getOpacities(yellowDark.yellow8).opacity60,
296
352
  warningButtonColor: yellowDark.yellow11,
353
+ infoBox: getOpacities(yellowDark.yellow8).opacity40,
297
354
  appCardBgColor: slateDark.slate2,
298
355
  appCardHoverColor: slateDark.slate2,
299
356
  appCardShadow: `0 0 0 1px ${getOpacities(slateDark.slate8).opacity50}, 0 2px 4px -4px ${
@@ -302,132 +359,25 @@ const darkColors = {
302
359
  appCardShadowHover: `0 0 0 1px ${getOpacities(slateDark.slate8).opacity60}, 0 6px 8px -4px ${
303
360
  getOpacities(slateDark.slate1).opacity100
304
361
  }`,
305
- modalBg: getOpacities(slateDark.slate8).opacity20,
362
+ modalBg: getOpacities(slateDark.slate2).opacity50,
363
+ modalShadow: `${getOpacities(slateDark.slate1).opacity40} 0px 16px 70px`,
364
+ modalContentBg: slateDark.slate3,
365
+ progressIconBg: getOpacities(slate.slate1).opacity10,
366
+ progressIconFill: getOpacities(slate.slate1).opacity60,
367
+ progressIconDoneBg: getOpacities(slate.slate1).opacity10,
368
+ progressIconDoneFill: getOpacities(slate.slate1).opacity80,
369
+ instrumentsMenuBg: getOpacities(slateDark.slate4).opacity95,
370
+ instrumentsMenuShadow: `0px 2px 8px ${getOpacities(slate.slate2).opacity95}`,
371
+ selectedColorBorder: getOpacities(slate.slate6).opacity20,
306
372
  //end
307
373
  placeholderTextColor: "#65788B",
308
374
  disabledInversedTextColor: lights.light,
309
- codeColor: "#F24461",
310
- codeBgColor: makeChromaColor("#F24461").luminance(0.88).desaturate(0.1).css(),
311
- danger: brandColors.red,
375
+ danger: redDark.red9,
312
376
  active: brandColors.red,
313
377
  warning: "#FFD41E",
314
378
  cardBg: slateDark.slate6,
315
379
  cardSelected: slateDark.slate5,
316
380
  cardSelectedHover: slateDark.slate5,
317
- menuSelected: "rgba(240, 244, 247, 1)",
318
- menuSelectedHover: "rgba(240, 244, 247, 1)",
319
- menuBg1: "#132331",
320
- menuBg2: "rgba(255, 255, 255, 0.05)",
321
- menuBg3: "rgba(255, 255, 255, 0.08)",
322
- infoBox: "rgba(255, 212, 0, 0.2)",
323
- errorBg: "rgba(255, 241, 240, 1)",
324
- timelineCard: "#FCE07D",
325
- transparent,
326
- shades,
327
- lights,
328
- separators: inversedSeparators,
329
- inversedSeparators: separators,
330
- } as const;
331
-
332
- const oldColors = {
333
- mode: "old",
334
- brandColors,
335
- stateColors,
336
- //old theme
337
- whiteColor: whiteA.whiteA0,
338
- blackColor: blackA.blackA0,
339
- mainBg: sage.sage3,
340
- panelBg: whiteA.whiteA0,
341
- panelContentBg: sage.sage2,
342
- pageBg: whiteA.whiteA0,
343
- pageContentBg: whiteA.whiteA0,
344
- sidebarBg: whiteA.whiteA0,
345
- sidebarShadow: `-3px 0px 10px 0px ${getOpacities(sage.sage2).opacity80}`,
346
- menuBg: "#132331",
347
- menuFooterColor: "rgba(255, 255, 255, 0.05)",
348
- menuFooterHoverColor: "rgba(255, 255, 255, 0.08)",
349
- textColor: "#2A3844",
350
- accentTextColor: "#65788B",
351
- disabledTextColor: shades.regular,
352
- inversedTextColor: "#FFFFFF",
353
- linkColor: indigoDark.indigo10,
354
- linkBorder: `1px solid ${getOpacities(indigoDark.indigo10).opacity30}`,
355
- linkHoverColor: indigo.indigo10,
356
- linkBorderHover: `1px solid ${getOpacities(indigo.indigo10).opacity80}`,
357
- entityNodeColor: slateDark.slate3,
358
- entityNodeBorder: `1px solid ${getOpacities(slateDark.slate3).opacity30}`,
359
- entityNodeHoverColor: slateDark.slate7,
360
- entityNodeBorderHover: `1px solid ${getOpacities(slate.slate11).opacity80}`,
361
- entityNodeBgColor: getOpacities(slate.slate3).opacity80,
362
- shortcutTextColor: slate.slate9,
363
- shortcutBorderColor: `1px solid ${getOpacities(slate.slate8).opacity20}`,
364
- inputBgColor: whiteA.whiteA0,
365
- inputDisabledBgColor: slate.slate2,
366
- inputCopyBgColor: slate.slate2,
367
- inputBorderColor: `0 0 0 1px ${shades.thin}`,
368
- inputBorderHoverColor: `0 0 0 1px ${shades.light}`,
369
- inputPlaceholderTextColor: "#65788B",
370
- buttonColor: slate.slate10,
371
- menuTextColor: "#FFFFFF",
372
- selectedMenuTextColor: "#FFFFFF",
373
- actionMenuBg: whiteA.whiteA0,
374
- actionMenuInnerBg: whiteA.whiteA0,
375
- actionMenuShadow: `0 0 0 1px rgba(17, 33, 58, 0.05), 0 16px 24px -8px rgba(17, 33, 58, 0.32)`,
376
- actionMenuHover: "rgba(240, 244, 247, 1)",
377
- actionMenuInnerHover: "rgba(240, 244, 247, 1)",
378
- actionMenuButtonColor: whiteA.whiteA0,
379
- actionMenuButtonHoverColor: slate.slate1,
380
- separatorColor: slate.slate3,
381
- iconColor: "#65788B",
382
- menuIconColor: "#65788B",
383
- selectedMenuIconColor: whiteA.whiteA0,
384
- appIconColor: getOpacities(whiteA.whiteA0).opacity90,
385
- mentionBgColor: slate.slate3,
386
- entityCardBgColor: "#FFFFFF",
387
- entityCardSelectedColor: "#FFFB8F",
388
- entityCardHoverColor: "#FFFFFF",
389
- entityCardDoneColor: lights.regular,
390
- entityCardShadow: `0 0 0 1px rgba(17, 33, 58, .08), 0 4px 4px -4px rgba(17, 33, 58, .40)`,
391
- entityCardShadowHover: `0 0 0 1px rgba(17, 33, 58, .1), 0 4px 8px -4px rgba(17, 33, 58, .68)`,
392
- unitBg: "rgba(220, 224, 228, 0.33)",
393
- unitBgHover: "rgba(220, 224, 228, 0.63)",
394
- badgeBgColor: getOpacities("#65788B").regular,
395
- tooltipBgColor: slateDark.slate5,
396
- todayMarkerColor: red.red8,
397
- viewBgOverlayColor: getOpacities(slate.slate8).opacity20,
398
- floatEditorMenuBg: slate.slate1,
399
- floatEditorActiveColor: indigoDark.indigo10,
400
- commentColor: getOpacities(yellow.yellow6).opacity60,
401
- cellBorderColor: getOpacities(slate.slate4).opacity50,
402
- tableRowWarningColor: getOpacities(yellow.yellow6).opacity60,
403
- warningBgColor: yellow.yellow6,
404
- warningButtonColor: yellow.yellow11,
405
- appCardBgColor: whiteA.whiteA0,
406
- appCardHoverColor: getOpacities(slate.slate1).opacity95,
407
- appCardShadow: `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 2px 4px -4px ${
408
- getOpacities(slate.slate10).opacity20
409
- }`,
410
- appCardShadowHover: `0 0 0 1px ${getOpacities(slate.slate10).opacity10}, 0 6px 8px -4px ${
411
- getOpacities(slate.slate10).opacity30
412
- }`,
413
- modalBg: getOpacities(slate.slate11).opacity20,
414
- //end
415
- placeholderTextColor: "#65788B",
416
- disabledInversedTextColor: lights.light,
417
- codeColor: "#F24461",
418
- codeBgColor: makeChromaColor("#F24461").luminance(0.88).desaturate(0.1).css(),
419
- danger: brandColors.red,
420
- active: brandColors.red,
421
- warning: "#FFD41E",
422
- cardBg: "#FFFFFF",
423
- cardSelected: "#FFFB8F",
424
- cardSelectedHover: "rgba(240, 244, 247, 0.6)",
425
- menuSelected: "rgba(240, 244, 247, 1)",
426
- menuSelectedHover: "rgba(240, 244, 247, 1)",
427
- menuBg1: "#132331",
428
- menuBg2: "rgba(255, 255, 255, 0.05)",
429
- menuBg3: "rgba(255, 255, 255, 0.08)",
430
- infoBox: "rgba(255, 212, 0, 0.2)",
431
381
  errorBg: "rgba(255, 241, 240, 1)",
432
382
  timelineCard: "#FCE07D",
433
383
  transparent,
@@ -435,6 +385,7 @@ const oldColors = {
435
385
  lights,
436
386
  separators: inversedSeparators,
437
387
  inversedSeparators: separators,
388
+ ...darkMenu,
438
389
  } as const;
439
390
 
440
391
  export function getLightColors(): typeof lightColors {
@@ -451,35 +402,25 @@ export function getDarkColors(): typeof darkColors {
451
402
  return darkColors;
452
403
  }
453
404
 
454
- export function getOldColors(): typeof oldColors {
405
+ export function getLight2Colors(): typeof light2Colors {
455
406
  if (process.env.NODE_ENV !== "test") {
456
407
  throw new Error("Only for test purpose");
457
408
  }
458
- return oldColors;
409
+ return light2Colors;
459
410
  }
460
411
 
461
- const getDefaultTheme = () => {
462
- if (typeof URLSearchParams !== "undefined" && typeof document !== "undefined") {
463
- let theme = null;
464
- try {
465
- const flagsValue = localStorage.getItem("persist:flags");
466
- const local = flagsValue ? JSON.parse(flagsValue) : {};
467
- theme = local["not-light-theme"] ? null : "light";
468
- } catch (e) {
469
- // sl
470
- }
471
- return new URLSearchParams(document.location.search).get("theme") || theme || "old";
472
- }
473
- return "old";
412
+ const getDefaultTheme = (): never => {
413
+ throw Error("Please specify theme mode");
474
414
  };
475
415
 
476
- type Mode = "dark" | "light" | "old";
477
-
478
- export function getThemeValue<T>(mode: Mode, values: Record<Mode, T>): T {
479
- return values[mode];
416
+ export function getThemeValue<T>(theme: ThemeMode, values: {light: T; light2?: T; dark: T}): T {
417
+ if (theme in values) {
418
+ return values[theme] as T;
419
+ }
420
+ return values.light;
480
421
  }
481
422
 
482
- function getTypeColors(themeColor: string) {
423
+ function getTypeColors(themeColor: string, theme: ThemeMode) {
483
424
  let color;
484
425
  // switch to chroma.valid once we start using 2.0.1
485
426
  try {
@@ -489,7 +430,21 @@ function getTypeColors(themeColor: string) {
489
430
  color = brandColors.green;
490
431
  }
491
432
  const boardBg = chroma(color).luminance(0.85).desaturate(0.2).set("hsl.h", "+2");
492
- return {
433
+
434
+ const lightTypeColors = {
435
+ primary: color,
436
+ opacity: getOpacities(color),
437
+ darkenPrimary: getDarkenColor(color),
438
+ brightenPrimary: chroma(color).luminance(0.92).desaturate(0.1).alpha(0.98).css(),
439
+ boardBg: boardBg.hex(),
440
+ boardBgOverlay: boardBg.alpha(0.8).css(),
441
+ headerBg: chroma(color).luminance(0.7).desaturate(0.5).set("hsl.h", "+2").css(),
442
+ detailsBg: chroma(color).alpha(0.6).luminance(0.85).hex(),
443
+ focus: chroma(color).alpha(0.25).css(),
444
+ separator: chroma(color).alpha(0.3).css(),
445
+ };
446
+
447
+ const darkTypeColors = {
493
448
  primary: color,
494
449
  opacity: getOpacities(color),
495
450
  darkenPrimary: getDarkenColor(color),
@@ -497,29 +452,43 @@ function getTypeColors(themeColor: string) {
497
452
  boardBg: boardBg.hex(),
498
453
  boardBgOverlay: boardBg.alpha(0.8).css(),
499
454
  headerBg: chroma(color).luminance(0.7).desaturate(0.5).set("hsl.h", "+2").css(),
500
- detailsBg: chroma(color).luminance(0.85).hex(),
455
+ detailsBg: chroma(color).alpha(0.03).luminance(0.8).darken(0.1).hex(),
501
456
  focus: chroma(color).alpha(0.25).css(),
502
457
  separator: chroma(color).alpha(0.3).css(),
503
458
  };
459
+
460
+ switch (theme) {
461
+ case "light":
462
+ return lightTypeColors;
463
+ case "dark":
464
+ return darkTypeColors;
465
+ case "light2":
466
+ return lightTypeColors;
467
+ default:
468
+ return lightTypeColors;
469
+ }
504
470
  }
505
471
 
506
- type DesignColor = typeof darkColors | typeof lightColors | typeof oldColors;
472
+ type DesignColor = typeof darkColors | typeof lightColors | typeof light2Colors;
507
473
 
508
474
  export type ThemeColors = ReturnType<typeof getTypeColors> & DesignColor;
509
475
 
510
476
  const colorsByTheme: Record<string, DesignColor> = {
511
477
  dark: darkColors,
512
478
  light: lightColors,
513
- old: oldColors,
479
+ light2: light2Colors,
514
480
  };
515
481
 
516
- export const getThemeColors = _.memoize((themeColor: string, theme: string = getDefaultTheme()): ThemeColors => {
517
- const colors = colorsByTheme[theme];
518
- return {
519
- ...getTypeColors(themeColor),
520
- ...colors,
521
- };
522
- });
482
+ export const getThemeColors: (themeColor: string, theme: ThemeMode) => ThemeColors = _.memoize(
483
+ (themeColor: string, theme: ThemeMode = getDefaultTheme()): ThemeColors => {
484
+ const colors = colorsByTheme[theme];
485
+ return {
486
+ ...getTypeColors(themeColor, theme),
487
+ ...colors,
488
+ };
489
+ },
490
+ (themeColor, theme) => themeColor + theme
491
+ );
523
492
 
524
493
  export const getTextColor = (color: string): string => {
525
494
  return makeChromaColor(color).luminance() > 0.45 ? makeChromaColor(color).luminance(0.1).saturate(3).hex() : "white";
@@ -529,8 +498,24 @@ export const getBrightenColor = (color: string): string => {
529
498
  return makeChromaColor(color).brighten(0.15).hex();
530
499
  };
531
500
 
532
- export const getLinkedHighlightBackgroundColor = (color: string): string => {
533
- return makeChromaColor(color).luminance(0.85).hex();
501
+ export const getLinkedHighlightBackgroundColor = (themeColors: ThemeColors, color: string): string => {
502
+ switch (themeColors.mode) {
503
+ case "dark":
504
+ return makeChromaColor(color).alpha(0.4).luminance(0.5).css();
505
+ case "light":
506
+ return makeChromaColor(color).alpha(0.3).luminance(0.6).css();
507
+ default:
508
+ return makeChromaColor(color).alpha(0.3).luminance(0.6).css();
509
+ }
510
+ };
511
+
512
+ export const getEnumBackgroundColor = (themeMode: ThemeMode, color: string) => {
513
+ switch (themeMode) {
514
+ case "dark":
515
+ return makeChromaColor(color).darken(2.2).alpha(0.5).saturate(1).css();
516
+ default:
517
+ return color;
518
+ }
534
519
  };
535
520
 
536
521
  export const cardTypeColors = [
@@ -555,7 +540,7 @@ export const cardTypeColors = [
555
540
  export const pastelColors = cardTypeColors.map((color) => makeChromaColor(color).luminance(0.8).hex());
556
541
 
557
542
  export const colors = {
558
- ...getTypeColors(brandColors.green),
543
+ ...getTypeColors(brandColors.green, "light"),
559
544
  brandColors,
560
545
  stateColors,
561
546
  textColor: "#2A3844",
@@ -564,22 +549,14 @@ export const colors = {
564
549
  inversedTextColor: "#FFFFFF",
565
550
  disabledInversedTextColor: lights.light,
566
551
  linkColor: brandColors.blue,
567
- codeColor: "#F24461",
568
- codeBgColor: makeChromaColor("#F24461").luminance(0.88).desaturate(0.1).css(),
569
552
  danger: brandColors.red,
570
553
  active: brandColors.red,
571
554
  warning: "#FFD41E",
572
555
  cardBg: "#FFFFFF",
573
556
  cardSelected: "#FFFB8F",
574
557
  cardSelectedHover: "rgba(240, 244, 247, 0.6)",
575
- menuSelected: "rgba(240, 244, 247, 1)",
576
- menuSelectedHover: "rgba(240, 244, 247, 1)",
577
558
  unitBg: "rgba(220, 224, 228, 0.33)",
578
- menuBg1: "#132331",
579
- menuBg2: "rgba(255, 255, 255, 0.075)",
580
- menuBg3: "rgba(81, 182, 157, 0.2)",
581
559
  infoBox: "rgba(255, 212, 0, 0.2)",
582
- modalBg: "rgba(26, 42, 94, 0.3)",
583
560
  errorBg: "rgba(255, 241, 240, 1)",
584
561
  timelineCard: "#FCE07D",
585
562
  timelineScaleSelectBorderColor: chroma("#FFFFFF").alpha(opacity.regular).css(),
@@ -672,13 +649,8 @@ export const viewBoxSize = "0 0 20 20";
672
649
  export const avatarSize = 24;
673
650
 
674
651
  export const shadows = {
675
- light: `0 1px 3px ${shades.hairline}`,
676
- lightReverted: `0 -1px 3px ${shades.hairline}`,
677
652
  border: `0 0 0 1px ${shades.thin}`,
678
653
  inversedBorder: `0 0 0 1px ${lights.thin}`,
679
- cardRegular: "0 0 0 1px rgba(17, 33, 58, .08), 0 4px 4px -4px rgba(17, 33, 58, .40)",
680
- cardHover: "0 0 0 1px rgba(17, 33, 58, .1), 0 4px 8px -4px rgba(17, 33, 58, .68)",
681
- dragging: "0 0 0 1px rgba(17, 33, 58, .08), 0 4px 4px -4px rgba(17, 33, 58, .40)",
682
654
  videoPreview: "0 4px 30px 4px rgba(0, 0, 0, .15)",
683
655
  } as const;
684
656
 
@@ -707,7 +679,7 @@ export const getObjectColorMemoized = _.memoize((name) => {
707
679
  return colorHash.hex(name);
708
680
  });
709
681
 
710
- export const themeVars = Object.keys(getThemeColors("#FFFFFF")).reduce((vars, key) => {
682
+ export const themeVars = Object.keys(getThemeColors("#FFFFFF", "light")).reduce((vars, key) => {
711
683
  if (key === "opacity") {
712
684
  vars[key] = Object.fromEntries(
713
685
  Object.keys(opacity).map((opacityKey) => [opacityKey, `var(--fibery-opacity-${opacityKey})`])
@@ -0,0 +1,55 @@
1
+ import {css} from "@linaria/core";
2
+ import {colors, getOpacities, layout, radius, space, textStyles} from "./designSystem";
3
+ import {Button} from "./Button";
4
+ import CloseIcon from "./icons/react/Close";
5
+
6
+ const errorAlert = css`
7
+ border: 1px solid ${colors.stateColors.error};
8
+ background-color: ${colors.errorBg};
9
+ padding: 0 ${space.l}px;
10
+ min-height: ${layout.itemHeight}px;
11
+ border-radius: ${radius}px;
12
+ display: flex;
13
+ gap: ${space.s}px;
14
+ align-items: center;
15
+ `;
16
+
17
+ const messageStyle = css`
18
+ ${textStyles.heading5}
19
+ `;
20
+
21
+ const descriptionStyle = css`
22
+ ${textStyles.regular}
23
+ `;
24
+
25
+ const buttonColor = getOpacities(colors.placeholderTextColor).overlay;
26
+
27
+ export function ErrorAlert({
28
+ message,
29
+ description,
30
+ closable,
31
+ onClose,
32
+ }: {
33
+ message: string;
34
+ description?: string;
35
+ closable?: boolean;
36
+ onClose?: () => void;
37
+ }): JSX.Element {
38
+ return (
39
+ <div className={errorAlert}>
40
+ <div
41
+ className={css`
42
+ flex-grow: 2;
43
+ `}
44
+ >
45
+ <div className={messageStyle}>{message}</div>
46
+ {description ? <div className={descriptionStyle}>{description}</div> : null}
47
+ </div>
48
+ {closable && onClose ? (
49
+ <div>
50
+ <Button borderless onClick={onClose} color={buttonColor} Icon={CloseIcon} width={26} />
51
+ </div>
52
+ ) : null}
53
+ </div>
54
+ );
55
+ }
@@ -1,5 +1,5 @@
1
1
  import {css} from "@linaria/core";
2
- import {colors, iconSize as defaultIconSize, radius, viewBoxSize} from "../designSystem";
2
+ import {themeVars, iconSize as defaultIconSize, radius, viewBoxSize} from "../designSystem";
3
3
  import {generateIconFromAst} from "./generateIconFromAst";
4
4
  import {IconProps} from "./types";
5
5
  import {getShiftStyle} from "./getShiftStyle";
@@ -37,7 +37,7 @@ export function Icon({
37
37
  style={getShiftStyle({containerSize, elementSize: iconSize})}
38
38
  className={iconStyle}
39
39
  >
40
- <g style={color === null ? {} : {fill: color || colors.textColor}}>{children}</g>
40
+ <g style={color === null ? {} : {fill: color || themeVars.textColor}}>{children}</g>
41
41
  </svg>
42
42
  ) : (
43
43
  generateIconFromAst(icon.icon.children[0], `svg-${icon.name}`, {
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const AppStoreOneColor: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"g","properties":{},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M13.73 8.229v4.488a.9.9 0 0 1-.9.9h-4.5a.9.9 0 1 1 0-1.8h2.328L5.794 6.954A.9.9 0 0 1 7.067 5.68l4.863 4.863V8.23a.9.9 0 0 1 1.8 0Z","fill":"#51B69D"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M1.03 5.7c0-4.113.588-4.7 4.7-4.7 4.113 0 4.7.587 4.7 4.7 0 .43-.006.821-.022 1.177l-1.59-1.59c-.01-.718-.046-1.24-.12-1.631-.084-.45-.197-.602-.259-.665-.062-.062-.215-.174-.664-.26-.462-.086-1.108-.121-2.045-.121-.937 0-1.582.035-2.044.122-.45.085-.602.197-.665.26-.062.062-.174.214-.259.664-.087.462-.122 1.107-.122 2.044s.035 1.582.122 2.044c.085.45.197.602.26.665.062.062.214.174.664.26.408.076.959.112 1.727.12l1.584 1.584c-.38.02-.8.027-1.267.027-4.113 0-4.7-.587-4.7-4.7ZM13.56 18.295c-3.555 0-4.48-.245-4.663-3.022h1.619c.018.213.046.203.076.366.085.45.197.602.26.665.062.062.214.174.664.259.462.087 1.108.122 2.045.122.937 0 1.582-.035 2.044-.122.45-.085.602-.197.664-.26.063-.062.175-.214.26-.664.087-.462.122-1.107.122-2.044s-.035-1.583-.122-2.045c-.085-.45-.197-.602-.26-.664-.062-.062-.214-.175-.664-.26-.163-.03-.157-.035-.37-.054V8.953c2.778.184 3.026 1.085 3.026 4.642 0 4.112-.588 4.7-4.7 4.7Z","fill":"#51B69D"},"children":[]}]}],"metadata":""}]},"name":"app-store-one-color"};
6
+ const AppStoreOneColor: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"g","properties":{"fill":"#51B69D"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M13.73 8.229v4.488a.9.9 0 0 1-.9.9h-4.5a.9.9 0 1 1 0-1.8h2.328L5.794 6.954A.9.9 0 0 1 7.067 5.68l4.863 4.863V8.23a.9.9 0 0 1 1.8 0Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M1.03 5.7c0-4.113.588-4.7 4.7-4.7 4.113 0 4.7.587 4.7 4.7 0 .43-.006.821-.022 1.177l-1.59-1.59c-.01-.718-.046-1.24-.12-1.631-.084-.45-.197-.602-.259-.665-.062-.062-.215-.174-.664-.26-.462-.086-1.108-.121-2.045-.121-.937 0-1.582.035-2.044.122-.45.085-.602.197-.665.26-.062.062-.174.214-.259.664-.087.462-.122 1.107-.122 2.044s.035 1.582.122 2.044c.085.45.197.602.26.665.062.062.214.174.664.26.408.076.959.112 1.727.12l1.584 1.584c-.38.02-.8.027-1.267.027-4.113 0-4.7-.587-4.7-4.7ZM13.56 18.295c-3.555 0-4.48-.245-4.663-3.022h1.619c.018.213.046.203.076.366.085.45.197.602.26.665.062.062.214.174.664.259.462.087 1.108.122 2.045.122.937 0 1.582-.035 2.044-.122.45-.085.602-.197.664-.26.063-.062.175-.214.26-.664.087-.462.122-1.107.122-2.044s-.035-1.583-.122-2.045c-.085-.45-.197-.602-.26-.664-.062-.062-.214-.175-.664-.26-.163-.03-.157-.035-.37-.054V8.953c2.778.184 3.026 1.085 3.026 4.642 0 4.112-.588 4.7-4.7 4.7Z"},"children":[]}]}],"metadata":""}]},"name":"app-store-one-color"};
7
7
 
8
8
  export default AppStoreOneColor;