@fibery/ui-kit 1.40.4 → 1.42.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 (143) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/eslint.config.mjs +16 -0
  3. package/package.json +10 -9
  4. package/src/a11y-color.test.ts +5 -24
  5. package/src/actions-menu/actions-menu-item.tsx +6 -9
  6. package/src/actions-menu/context-actions-menu.tsx +8 -3
  7. package/src/ai/model.tsx +0 -1
  8. package/src/ai/temperature.tsx +0 -1
  9. package/src/animated-height-container.tsx +3 -3
  10. package/src/antd/index.tsx +3 -0
  11. package/src/antd/input.tsx +0 -1
  12. package/src/antd/styles.ts +9 -9
  13. package/src/app-icon-with-fallback.tsx +5 -5
  14. package/src/app-icon-wrapper.tsx +2 -3
  15. package/src/app-icon.tsx +3 -3
  16. package/src/avatar.tsx +3 -3
  17. package/src/button/base-button.tsx +0 -1
  18. package/src/button/make-button-colors.ts +2 -2
  19. package/src/checkbox.tsx +1 -1
  20. package/src/collapsible-section.tsx +11 -1
  21. package/src/color-utils.test.ts +15 -25
  22. package/src/color-utils.ts +43 -8
  23. package/src/command-menu/index.tsx +1 -0
  24. package/src/context-menu/index.tsx +5 -5
  25. package/src/date-picker/contexts.ts +2 -2
  26. package/src/date-picker/date-range-picker-popup-content.tsx +1 -2
  27. package/src/date-picker/date-range-picker.tsx +29 -31
  28. package/src/date-picker/single-date-picker-popup-content.tsx +1 -2
  29. package/src/date-picker/single-date-picker.tsx +149 -124
  30. package/src/date-picker/types.ts +4 -4
  31. package/src/day-select/iso-week-day-select.tsx +2 -2
  32. package/src/day-select/week-day-select.tsx +2 -2
  33. package/src/delayed.tsx +0 -1
  34. package/src/design-system/alpha.test.ts +59 -0
  35. package/src/design-system/alpha.ts +41 -0
  36. package/src/design-system/animation.ts +10 -0
  37. package/src/design-system/colors-css.test.ts +39 -0
  38. package/src/design-system/colors-css.ts +25 -0
  39. package/src/design-system/colors-js.test.ts +232 -0
  40. package/src/design-system/colors-js.ts +107 -0
  41. package/src/design-system/colors.test.ts +74 -0
  42. package/src/{design-system.colors.ts → design-system/colors.ts} +133 -134
  43. package/src/design-system/date.ts +3 -0
  44. package/src/design-system/layout.ts +106 -0
  45. package/src/design-system/theme.test.ts +94 -0
  46. package/src/design-system/theme.ts +93 -0
  47. package/src/design-system/typography.ts +179 -0
  48. package/src/design-system/vars.test.ts +1679 -0
  49. package/src/design-system/vars.ts +52 -0
  50. package/src/design-system.test.ts +46 -303
  51. package/src/design-system.ts +25 -545
  52. package/src/dropdown-menu/index.tsx +5 -5
  53. package/src/emoji-picker/icon-emoji-picker.tsx +1 -1
  54. package/src/fibermoji-placeholder.tsx +3 -3
  55. package/src/field-container.tsx +11 -2
  56. package/src/file-item/file-icon.tsx +3 -3
  57. package/src/file-item-2.tsx +4 -10
  58. package/src/file-item.tsx +0 -1
  59. package/src/icons/ast/ChatBubble.ts +8 -0
  60. package/src/icons/ast/ChatFloat.ts +8 -0
  61. package/src/icons/ast/ChatSidebar.ts +8 -0
  62. package/src/icons/ast/FileOther.ts +8 -0
  63. package/src/icons/ast/NoBorder.ts +8 -0
  64. package/src/icons/ast/NoFill.ts +8 -0
  65. package/src/icons/ast/index.tsx +6 -0
  66. package/src/icons/react/ChatBubble.tsx +13 -0
  67. package/src/icons/react/ChatFloat.tsx +13 -0
  68. package/src/icons/react/ChatSidebar.tsx +13 -0
  69. package/src/icons/react/FileOther.tsx +13 -0
  70. package/src/icons/react/NoBorder.tsx +13 -0
  71. package/src/icons/react/NoFill.tsx +13 -0
  72. package/src/icons/react/index.tsx +6 -0
  73. package/src/icons/svg/chat-bubble.svg +4 -0
  74. package/src/icons/svg/chat-float.svg +4 -0
  75. package/src/icons/svg/chat-sidebar.svg +4 -0
  76. package/src/icons/svg/file-other.svg +3 -0
  77. package/src/icons/svg/no-border.svg +17 -0
  78. package/src/icons/svg/no-fill.svg +4 -0
  79. package/src/images-gallery/images-gallery.tsx +8 -6
  80. package/src/images-gallery/slide-buttons.tsx +2 -2
  81. package/src/is-iOS.ts +0 -1
  82. package/src/is-in-popup.ts +2 -1
  83. package/src/lists/actions-menu-row-surface.tsx +4 -4
  84. package/src/loading-sausage.tsx +2 -2
  85. package/src/media-query-utils.ts +1 -2
  86. package/src/mobile-keyboard-aware-popup.tsx +2 -2
  87. package/src/modal-menu/modal-menu-content.tsx +2 -2
  88. package/src/number-input/decimal.js +9 -7
  89. package/src/number-input/{number-inline-input-with-autosize.tsx → number-input-inline-with-autosize.tsx} +20 -41
  90. package/src/number-input/number-input-inline.tsx +118 -0
  91. package/src/number-input/{index.test.js → number-input.test.tsx} +38 -43
  92. package/src/number-input/number-input.tsx +63 -121
  93. package/src/number-input/types.ts +19 -0
  94. package/src/number-input/utils.ts +61 -0
  95. package/src/online-users.tsx +2 -2
  96. package/src/palette-generator.test.ts +24 -281
  97. package/src/palette-generator.ts +39 -45
  98. package/src/palettes/_.ts +72 -0
  99. package/src/palettes/slate-arch.colors-snapshot.test.ts +1689 -0
  100. package/src/palettes/slate-arch.ts +188 -0
  101. package/src/palettes/slate-user.colors-snapshot.test.ts +1689 -0
  102. package/src/palettes/slate-user.ts +187 -0
  103. package/src/palettes/warm-arch.colors-snapshot.test.ts +1689 -0
  104. package/src/palettes/warm-arch.ts +222 -0
  105. package/src/palettes/warm-user.colors-snapshot.test.ts +1689 -0
  106. package/src/palettes/warm-user.ts +222 -0
  107. package/src/popover/get-element-ref.ts +28 -0
  108. package/src/popover/index.tsx +232 -333
  109. package/src/popover/{mobile-popup-context.tsx → mobile-popover-context.tsx} +7 -7
  110. package/src/popover/mobile-popover.tsx +169 -0
  111. package/src/popover/modifiers.tsx +2 -2
  112. package/src/popover/popup-stack-context.tsx +8 -9
  113. package/src/root-theme-provider.test.tsx +114 -19
  114. package/src/scale-generator.ts +31 -22
  115. package/src/select/components/menu-list-virtualized.tsx +5 -3
  116. package/src/select/index.tsx +6 -5
  117. package/src/select/select.tsx +36 -38
  118. package/src/select/util.ts +1 -1
  119. package/src/static-palettes.ts +221 -11
  120. package/src/thematic-controls.tsx +6 -6
  121. package/src/thematic-scales.tsx +15 -15
  122. package/src/thematic-state.ts +57 -20
  123. package/src/thematic.tsx +36 -32
  124. package/src/theme-provider.test.tsx +31 -19
  125. package/src/theme-provider.tsx +41 -38
  126. package/src/theme-settings.ts +66 -11
  127. package/src/theme-styles.ts +53 -8
  128. package/src/toast/toast.tsx +1 -2
  129. package/src/toggle.tsx +2 -2
  130. package/src/tooltip.tsx +4 -3
  131. package/src/type-badge.tsx +4 -11
  132. package/src/unit/styles.ts +0 -23
  133. package/src/use-is-phone.tsx +7 -2
  134. package/src/use-on-screen-keyboard-data.tsx +2 -2
  135. package/src/with-data.tsx +4 -3
  136. package/src/workflow-progress-icon.tsx +2 -2
  137. package/.eslintignore +0 -3
  138. package/.eslintrc +0 -14
  139. package/src/__mocks__/createInlineTheme.js +0 -3
  140. package/src/__snapshots__/design-system.test.ts.snap +0 -7265
  141. package/src/create-inline-theme.ts +0 -67
  142. package/src/number-input/index.js +0 -191
  143. package/src/palette.ts +0 -253
@@ -1,545 +1,25 @@
1
- /* eslint-disable max-lines */
2
- import ColorHash from "color-hash";
3
- import _ from "lodash";
4
- import {
5
- clampRgb,
6
- darkenChroma,
7
- desaturateChroma,
8
- isValidColor,
9
- produceColor,
10
- set,
11
- setAlpha,
12
- setLuminanceChroma,
13
- toCss,
14
- } from "./color-utils";
15
- import {createInlineTheme as createInlineStyles, varPrefix} from "./create-inline-theme";
16
- import {ThemeMode} from "./theme-settings";
17
- import {defaultPaletteKey, makeDefaultPalette, ThemePalette} from "./palette-generator";
18
- import {
19
- brandColors,
20
- getOpacities,
21
- makeThemeDefs,
22
- pickDarkColors,
23
- pickFns,
24
- pickLight2Colors,
25
- pickLightColors,
26
- ThemeDefs,
27
- } from "./design-system.colors";
28
-
29
- export {cardTypeColors, opacity, getOpacities} from "./design-system.colors";
30
-
31
- export const typeSizes = [30, 24, 18, 16, 14, 12, 10, 8] as const;
32
-
33
- export const fontWeight = {
34
- light: 310, // 300 basic, 310 experiment with a variable Inter
35
- regular: 410, // 400 basic, 410 experiment with a variable Inter
36
- mediumLight: 450,
37
- medium: 500,
38
- semibold: 600,
39
- bold: 700,
40
- } as const;
41
-
42
- // 300 basic, 310 experiment with a variable Inter
43
- export const fontSize = {
44
- xxl: 30,
45
- xl: 24,
46
- lg: 18,
47
- md: 16,
48
- sm: 15,
49
- xs: 14,
50
- xxs: 13,
51
- xxxs: 12,
52
- tiny: 11,
53
- mini: 10,
54
- micro: 9,
55
- nano: 8,
56
- } as const;
57
-
58
- export const minPanelWidth = 490;
59
-
60
- export const fontFamily =
61
- '"Inter Variable", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif';
62
-
63
- export function getThemeValue<T>(theme: ThemeMode, values: {light: T; light2?: T; dark: T}): T {
64
- if (theme in values) {
65
- return values[theme] as T;
66
- }
67
- return values.light;
68
- }
69
-
70
- export const getDarkenColor = _.memoize((color: string): string => {
71
- return produceColor(color, [(c) => darkenChroma(c, 0.5), clampRgb, (c) => desaturateChroma(c, 0.8)]);
72
- });
73
-
74
- function getTypeColors(themeColor: string, theme: ThemeMode) {
75
- const color = isValidColor(themeColor) ? themeColor : brandColors.green;
76
-
77
- const makeBrightenPrimary = () => {
78
- return produceColor(color, [
79
- (c) => setLuminanceChroma(c, 0.92),
80
- (c) => desaturateChroma(c, 0.1),
81
- (c) => setAlpha(c, 0.98),
82
- ]);
83
- };
84
-
85
- const makeHeaderBg = () => {
86
- return produceColor(color, [
87
- (c) => setLuminanceChroma(c, 0.7),
88
- (c) => desaturateChroma(c, 0.5),
89
- (c) => set(c, "hsl.h", (h) => h + 2),
90
- ]);
91
- };
92
-
93
- const makeLightDetailsBg = () => {
94
- return produceColor(color, [(c) => setAlpha(c, 0.5), (c) => setLuminanceChroma(c, 0.85)]);
95
- };
96
-
97
- const makeDarkDetailsBg = () => {
98
- return produceColor(color, [
99
- (c) => setAlpha(c, 0.03),
100
- (c) => setLuminanceChroma(c, 0.8),
101
- (c) => desaturateChroma(c, 0.8),
102
- (c) => darkenChroma(c, 0.1),
103
- ]);
104
- };
105
-
106
- const makeFocus = () => {
107
- return produceColor(color, (c) => setAlpha(c, 0.25));
108
- };
109
-
110
- const makeSeparator = () => {
111
- return produceColor(color, (c) => setAlpha(c, 0.3));
112
- };
113
-
114
- const lightTypeColors = {
115
- primary: color,
116
- opacity: getOpacities(color),
117
- darkenPrimary: getDarkenColor(color),
118
- brightenPrimary: makeBrightenPrimary(),
119
- headerBg: makeHeaderBg(),
120
- detailsBg: makeLightDetailsBg(),
121
- focus: makeFocus(),
122
- separator: makeSeparator(),
123
- };
124
-
125
- const darkTypeColors = {
126
- primary: color,
127
- opacity: getOpacities(color),
128
- darkenPrimary: getDarkenColor(color),
129
- brightenPrimary: makeBrightenPrimary(),
130
- headerBg: makeHeaderBg(),
131
- detailsBg: makeDarkDetailsBg(),
132
- focus: makeFocus(),
133
- separator: makeSeparator(),
134
- };
135
-
136
- switch (theme) {
137
- case "light":
138
- return lightTypeColors;
139
- case "dark":
140
- return darkTypeColors;
141
- case "light2":
142
- return lightTypeColors;
143
- default:
144
- return lightTypeColors;
145
- }
146
- }
147
-
148
- type DesignColor =
149
- | ReturnType<typeof pickDarkColors>
150
- | ReturnType<typeof pickLightColors>
151
- | ReturnType<typeof pickLight2Colors>;
152
-
153
- type ThemeFns = {
154
- [K in keyof ThemeDefs["fns"]]: ThemeDefs["fns"][K]["light"];
155
- };
156
-
157
- export type ThemeColors = {key: string; fns: ThemeFns} & ReturnType<typeof getTypeColors> & DesignColor;
158
-
159
- export type ThemeVars = Omit<ThemeColors, "key" | "fns">;
160
-
161
- export const getThemeColors = _.memoize(
162
- (_: string | null, mode: ThemeMode, palette: ThemePalette = makeDefaultPalette()): ThemeColors => {
163
- const defs = makeThemeDefs(palette);
164
- const colors =
165
- mode === "dark" ? pickDarkColors(defs) : mode === "light2" ? pickLight2Colors(defs) : pickLightColors(defs);
166
-
167
- return {
168
- key: `${palette.key}-${mode}`,
169
- fns: pickFns(defs.fns, mode) as ThemeFns,
170
- ...getTypeColors(brandColors.blue, mode),
171
- ...colors,
172
- };
173
- },
174
- (_, mode, palette) => `${palette?.key ?? defaultPaletteKey}-${mode}`
175
- );
176
-
177
- export const getTextColor = _.memoize((color: string): string => {
178
- return toCss(color);
179
- });
180
-
181
- export const getEnumTextColor = (color: string) => {
182
- return `color-mix(in srgb, ${color} 25%, ${themeVars.textColor} 75%)`;
183
- };
184
-
185
- export const dropCursorColor = produceColor(brandColors.blue, (c) => setAlpha(c, 0.7));
186
-
187
- export const space = {
188
- spaceAuto: "auto",
189
- s0: 0,
190
- s1: 1,
191
- s2: 2,
192
- s3: 3,
193
- s4: 4,
194
- s5: 5,
195
- s6: 6,
196
- s8: 8,
197
- s10: 10,
198
- s12: 12,
199
- s14: 14,
200
- s16: 16,
201
- s18: 18,
202
- s20: 20,
203
- s24: 24,
204
- s28: 28,
205
- s32: 32,
206
- s36: 36,
207
- s40: 40,
208
- s44: 44,
209
- s48: 48,
210
- s56: 56,
211
- s60: 60,
212
- s64: 64,
213
- s80: 80,
214
- s96: 96,
215
- s112: 112,
216
- s128: 128,
217
- } as const;
218
- /** Token for nested items spacing in nested trees */
219
- export const spaceNestedTreeLevel = 12;
220
- export const spaceNestedTreeInterval = 0;
221
- export const layout = {
222
- logoSize: 18,
223
- menuDefaultWidth: 243,
224
- fiberyAiSidebarDefaultWidth: 420,
225
- fiberyAiSidebarMaxWidth: 920,
226
- desktopToolbarHeight: 32,
227
- desktopMenuMinWidth: 240,
228
- collapsedMenuMinWidth: 47,
229
- menuMinWidth: 284,
230
- menuMaxWidth: 480,
231
- menuItemMinWidth: 80,
232
- menuGroupHeaderIndent: 28, // I'm ok
233
- menuItemLevelIndent: 24,
234
- listItemHeight: 38,
235
- mobileListItemHeight: 44,
236
- itemHeight: 36,
237
- itemWithSubtitleHeight: 52,
238
- groupTitleHeight: 30,
239
- enumItemHeight: 32,
240
- menuItemHeight: 32,
241
- mobileMenuItemHeight: 44,
242
- newMenuItemHeight: 28, // I'm ok
243
- mobileSidebarMenuItemHeight: 44,
244
- newMenuIconSize: 18,
245
- mobileSidebarIconSize: 20,
246
- viewHeaderHeight: space.s12 * 7,
247
- viewHeaderCompactHeight: 52,
248
- columnMinWidth: 240,
249
- columnWidths: {compact: 200, default: 240, list: 280, full: 320},
250
- objectEditorMinWidth: 480,
251
- typeEditorWidth: "30vw",
252
- typeEditorMinWidth: 480,
253
- viewSetupWidth: "30vw",
254
- viewSetupMinWidth: 380,
255
- inputHeight: 36, //TODO: merge input and item height?
256
- timelineToolbarHeight: 48,
257
- timelineLineHeight: 40,
258
- timelineGroupPadding: 0,
259
- timelineItemHeightRatio: 32 / 40,
260
- timelineHeaderHeight: 48,
261
- calendarEventHeight: 30,
262
- calendarHeaderHeight: 30,
263
- calendarToolbarHeight: 48,
264
- checkboxSize: 15,
265
- fakeBoardWidth: 260,
266
- fakeBoardHeight: 160,
267
- inlineInputHeight: 32,
268
- menuHeight: 32,
269
- popupTopMargin: 48,
270
- unitHeight: 18,
271
- } as const;
272
-
273
- export const themeVars = makeThemeVars(getThemeColors(null, "light"), varPrefix);
274
-
275
- export const menuItemHeightVar = `--${varPrefix}-layout-menuItemHeight`;
276
- export const sidebarMenuItemHeightVar = `--${varPrefix}-layout-sidebarMenuItemHeight`;
277
- export const sidebarMenuIconSizeVar = `--${varPrefix}-layout-sidebarMenuIconSize`;
278
- export const listRowSurfaceFontSizeVar = `--${varPrefix}-layout-listRowSurfaceFontSize`;
279
-
280
- export const layoutVars = {
281
- menuItemHeight: `var(${menuItemHeightVar})`,
282
- sidebarMenuItemHeight: `var(${sidebarMenuItemHeightVar})`,
283
- sidebarMenuIconSize: `var(${sidebarMenuIconSizeVar})`,
284
- listRowSurfaceFontSize: `var(${listRowSurfaceFontSizeVar})`,
285
- };
286
-
287
- export const border = {
288
- radius0: 0,
289
- radius1: 1,
290
- radius2: 2,
291
- radius4: 4,
292
- radius5: 5,
293
- radius6: 6,
294
- radius8: 8,
295
- radius10: 10,
296
- radius12: 12,
297
- radius16: 16,
298
- radius9999: 9999,
299
- } as const;
300
-
301
- export const lineHeight = {
302
- text: 1.6,
303
- regular: 1.5,
304
- narrow: 1.4,
305
- heading: 1.3,
306
- nowrap: 1,
307
- } as const;
308
-
309
- export const tooltipDelay = {
310
- enter: 500,
311
- leave: 0,
312
- } as const;
313
-
314
- export const duration = 120;
315
- export const easing = "ease-in-out";
316
- export const transition = `${duration}ms ${easing}`;
317
-
318
- export const iconSize = 20;
319
- export const viewBoxSize = "0 0 20 20";
320
-
321
- export const shadows = {
322
- border: `0 0 0 1px ${themeVars.shades.opacity10}`,
323
- inversedBorder: `0 0 0 1px ${themeVars.lights.opacity10}`,
324
- videoPreview: "0 4px 30px 4px rgba(0, 0, 0, .15)",
325
- } as const;
326
-
327
- export const dateFormat = "MMM D, YYYY";
328
- export const dateTimeFormat = "MMM D, YYYY HH:mm";
329
- export const timeFormat = "HH:mm";
330
-
331
- export const getLinearGradient = (backgroundColors: Array<string>): string => {
332
- const parts = _.flatMap(
333
- backgroundColors.map((color, index, arr) => [
334
- `${color} ${(index / arr.length) * 100}%`,
335
- `${color} ${((index + 1) / arr.length) * 100}%`,
336
- ])
337
- );
338
- return `linear-gradient(to bottom, ${parts.join(", ")})`;
339
- };
340
-
341
- export const getObjectColorMemoized = _.memoize((name) => {
342
- if (!name) {
343
- return "#999999";
344
- }
345
- const colorHash = new ColorHash({
346
- lightness: [0.5, 0.6, 0.7],
347
- saturation: [0.6, 0.7, 0.8, 0.9, 1],
348
- });
349
- return colorHash.hex(name);
350
- });
351
-
352
- function makeThemeVars(sample: ThemeColors, varPrefix: string) {
353
- const vars = {} as Record<string, string | {[k: string]: string}>;
354
- for (const [key, value] of Object.entries(sample)) {
355
- if (key === "opacity") {
356
- vars[key] = Object.fromEntries(
357
- Object.keys(value).map((opacityKey) => [opacityKey, `var(--${varPrefix}-opacity-${opacityKey})`])
358
- );
359
- } else if (key === "brandColors") {
360
- vars[key] = Object.fromEntries(
361
- Object.keys(value).map((brandColorKey) => [brandColorKey, `var(--${varPrefix}-brand-colors-${brandColorKey})`])
362
- );
363
- } else if (key === "shades") {
364
- vars[key] = Object.fromEntries(
365
- Object.keys(value).map((shadeKey) => [shadeKey, `var(--${varPrefix}-shades-${shadeKey})`])
366
- );
367
- } else if (key === "lights") {
368
- vars[key] = Object.fromEntries(
369
- Object.keys(value).map((lightKey) => [lightKey, `var(--${varPrefix}-lights-${lightKey})`])
370
- );
371
- } else if (key === "separators") {
372
- vars[key] = Object.fromEntries(
373
- Object.keys(value).map((separatorKey) => [separatorKey, `var(--${varPrefix}-separator-${separatorKey})`])
374
- );
375
- } else if (key === "inversedSeparators") {
376
- vars[key] = Object.fromEntries(
377
- Object.keys(value).map((separatorKey) => [
378
- separatorKey,
379
- `var(--${varPrefix}-inversed-separator-${separatorKey})`,
380
- ])
381
- );
382
- } else if (key !== "key" && key !== "fns") {
383
- vars[key] = `var(--${varPrefix}-color-${key})`;
384
- }
385
- }
386
- return vars as ThemeVars;
387
- }
388
-
389
- /** @deprecated make this dark-vs-light theme override optimization more explicit */
390
- export const defaultThemeKeys = Object.keys(pickLightColors(makeThemeDefs(makeDefaultPalette())));
391
- export const rejectNoKeys: string[] = [];
392
-
393
- export const createInlineTheme = _.memoize(
394
- (theme: ThemeColors, rejectKeys = defaultThemeKeys) => {
395
- return createInlineStyles<ThemeColors>(theme, rejectKeys);
396
- },
397
- (theme, rejectKeys = defaultThemeKeys) => {
398
- const rejectKeysLabel = rejectKeys === defaultThemeKeys ? "defaultThemeKeys" : rejectKeys.join(",");
399
- return `${theme.key}__${rejectKeysLabel}`;
400
- }
401
- );
402
-
403
- export const textStyles = {
404
- heading1: {
405
- fontFamily,
406
- fontSize: typeSizes[0],
407
- letterSpacing: "-0.01em",
408
- lineHeight: lineHeight.heading,
409
- fontWeight: fontWeight.semibold,
410
- color: themeVars.textColor,
411
- },
412
- heading2: {
413
- fontFamily,
414
- fontSize: typeSizes[1],
415
- letterSpacing: "-0.002em",
416
- lineHeight: lineHeight.heading,
417
- fontWeight: fontWeight.semibold,
418
- color: themeVars.textColor,
419
- },
420
- heading3: {
421
- fontFamily,
422
- fontSize: typeSizes[2],
423
- letterSpacing: "-0.002em",
424
- lineHeight: lineHeight.heading,
425
- fontWeight: fontWeight.semibold,
426
- color: themeVars.textColor,
427
- },
428
- heading4: {
429
- fontFamily,
430
- fontSize: typeSizes[3],
431
- lineHeight: lineHeight.heading,
432
- fontWeight: fontWeight.semibold,
433
- color: themeVars.textColor,
434
- },
435
- heading5: {
436
- fontFamily,
437
- fontSize: typeSizes[4],
438
- lineHeight: lineHeight.heading,
439
- fontWeight: fontWeight.semibold,
440
- color: themeVars.textColor,
441
- },
442
- heading6: {
443
- fontFamily,
444
- fontSize: typeSizes[5],
445
- lineHeight: lineHeight.heading,
446
- letterSpacing: 0.6,
447
- textTransform: "uppercase",
448
- fontWeight: fontWeight.regular,
449
- color: themeVars.textColor,
450
- },
451
- heading7: {
452
- fontFamily,
453
- fontSize: typeSizes[6],
454
- lineHeight: lineHeight.heading,
455
- letterSpacing: 0.6,
456
- textTransform: "uppercase",
457
- fontWeight: fontWeight.regular,
458
- color: themeVars.textColor,
459
- },
460
- heading8: {
461
- fontFamily,
462
- fontSize: typeSizes[6],
463
- lineHeight: lineHeight.heading,
464
- fontWeight: fontWeight.medium,
465
- color: themeVars.textColor,
466
- },
467
- big: {
468
- fontFamily,
469
- fontSize: typeSizes[3],
470
- lineHeight: lineHeight.regular,
471
- fontWeight: fontWeight.regular,
472
- color: themeVars.textColor,
473
- },
474
- regular: {
475
- fontFamily,
476
- fontSize: typeSizes[4],
477
- lineHeight: lineHeight.regular,
478
- fontWeight: fontWeight.regular,
479
- color: themeVars.textColor,
480
- textTransform: "none",
481
- letterSpacing: "normal",
482
- },
483
- small: {
484
- fontFamily,
485
- fontSize: typeSizes[5],
486
- lineHeight: lineHeight.regular,
487
- fontWeight: fontWeight.regular,
488
- color: themeVars.textColor,
489
- textTransform: "none",
490
- },
491
- code: {
492
- fontFamily: '"SFMono-Regular", Menlo, Consolas, "PT Mono", "Liberation Mono", Courier, monospace',
493
- fontSize: typeSizes[4],
494
- lineHeight: lineHeight.regular,
495
- fontWeight: fontWeight.regular,
496
- color: themeVars.textColor,
497
- },
498
- link: {
499
- color: themeVars.linkColor,
500
- borderBottom: themeVars.linkBorder,
501
- textDecoration: "none",
502
- cursor: "pointer",
503
- transition: `border ${transition}`,
504
- },
505
- inversedLink: {
506
- color: themeVars.inversedTextColor,
507
- cursor: "pointer",
508
- textDecoration: "underline",
509
- textDecorationColor: themeVars.lights.opacity25,
510
- },
511
- note: {
512
- fontFamily,
513
- fontSize: typeSizes[3],
514
- lineHeight: lineHeight.regular,
515
- fontWeight: fontWeight.regular,
516
- color: themeVars.textColor,
517
- borderRadius: border.radius6,
518
- },
519
- important: {
520
- fontFamily,
521
- fontSize: typeSizes[3],
522
- lineHeight: lineHeight.regular,
523
- fontWeight: fontWeight.regular,
524
- color: themeVars.textColor,
525
- border: `1px solid ${themeVars.active}`,
526
- borderRadius: border.radius6,
527
- },
528
- numeric: {
529
- tabularOn: {
530
- fontVariantNumeric: "tabular-nums",
531
- fontFeatureSettings: '"tnum" 1',
532
- },
533
- tabularOff: {
534
- fontVariantNumeric: "normal",
535
- fontFeatureSettings: '"tnum" 0',
536
- },
537
- },
538
- inherit: {
539
- fontFamily: "inherit",
540
- fontSize: "inherit",
541
- lineHeight: "inherit",
542
- fontWeight: "inherit",
543
- color: "inherit",
544
- },
545
- } as const;
1
+ export {opacity, getOpacities} from "./design-system/alpha";
2
+ export {transition, easing, duration, tooltipDelay} from "./design-system/animation";
3
+ export {cardTypeColors} from "./design-system/colors";
4
+ export {getLinearGradient, getEnumTextColor, dropCursorColor, shadows} from "./design-system/colors-css";
5
+ export {getDarkenColor, getTextColor, getObjectColorMemoized} from "./design-system/colors-js";
6
+ export {dateFormat, dateTimeFormat, timeFormat} from "./design-system/date";
7
+ export {
8
+ iconSize,
9
+ border,
10
+ space,
11
+ layout,
12
+ spaceNestedTreeInterval,
13
+ spaceNestedTreeLevel,
14
+ viewBoxSize,
15
+ minPanelWidth,
16
+ } from "./design-system/layout";
17
+ export {type ThemeColors, getThemeColors, createInlineStyles, themeVars, type ThemeStyles} from "./design-system/theme";
18
+ export {typeSizes, fontSize, fontFamily, fontWeight, lineHeight, textStyles} from "./design-system/typography";
19
+ export {
20
+ layoutVars,
21
+ menuItemHeightVar,
22
+ listRowSurfaceFontSizeVar,
23
+ sidebarMenuItemHeightVar,
24
+ sidebarMenuIconSizeVar,
25
+ } from "./design-system/vars";
@@ -5,7 +5,7 @@ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5
5
  import {forwardRef} from "react";
6
6
  import {border, layout, space, textStyles, themeVars} from "../design-system";
7
7
  import {mobileRootSelector} from "../mobile-styles";
8
- import {ThemeProvider} from "../theme-provider";
8
+ import {RadixPortalThemeProvider} from "../theme-provider";
9
9
 
10
10
  export const Root = (dropdownMenuProps: DropdownMenuPrimitive.DropdownMenuProps) => (
11
11
  <DropdownMenuPrimitive.Root dir="ltr" modal={false} {...dropdownMenuProps} />
@@ -134,7 +134,7 @@ export const Content = forwardRef<HTMLDivElement, ContentProps>(function Dropdow
134
134
  ) {
135
135
  return (
136
136
  <Wrap if={portalled} with={DropdownMenuPrimitive.Portal} container={container}>
137
- <ThemeProvider portal>
137
+ <RadixPortalThemeProvider>
138
138
  <DropdownMenuPrimitive.Content
139
139
  onKeyDown={onContentKeyDown}
140
140
  ref={ref}
@@ -145,7 +145,7 @@ export const Content = forwardRef<HTMLDivElement, ContentProps>(function Dropdow
145
145
  sideOffset={space.s4}
146
146
  {...rest}
147
147
  />
148
- </ThemeProvider>
148
+ </RadixPortalThemeProvider>
149
149
  </Wrap>
150
150
  );
151
151
  });
@@ -158,14 +158,14 @@ export const SubContent = forwardRef<
158
158
  >(function DropdownMenuSubContent({className, collisionPadding = space.s12, container, ...rest}, ref) {
159
159
  return (
160
160
  <DropdownMenuPrimitive.Portal container={container}>
161
- <ThemeProvider portal>
161
+ <RadixPortalThemeProvider>
162
162
  <DropdownMenuPrimitive.SubContent
163
163
  ref={ref}
164
164
  className={cx(dropdownMenuContentStyles, className)}
165
165
  collisionPadding={collisionPadding}
166
166
  {...rest}
167
167
  />
168
- </ThemeProvider>
168
+ </RadixPortalThemeProvider>
169
169
  </DropdownMenuPrimitive.Portal>
170
170
  );
171
171
  });
@@ -1,5 +1,5 @@
1
1
  import {css} from "@linaria/core";
2
- import {compact} from "lodash";
2
+ import compact from "lodash/compact";
3
3
  import {Button} from "../button/button";
4
4
  import {space, themeVars} from "../design-system";
5
5
  import EmojiDelete from "../icons/react/EmojiDelete";
@@ -1,4 +1,4 @@
1
- import _ from "lodash";
1
+ import memoize from "lodash/memoize";
2
2
  import {css} from "@linaria/core";
3
3
  import {FC, useEffect, useRef} from "react";
4
4
  import {textStyles} from "./design-system";
@@ -38,12 +38,12 @@ const mouths = [
38
38
  `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="16" viewBox="0 0 32 16" fill="none"><g clip-path="url(#clip0_31_1134)"><path d="M4.23177 12.4853C2.41601 11.1761 1.06315 9.59547 0.249133 7.87572C-0.702621 5.86498 1.22002 4 3.51791 4L7 4C7.55229 4 8 4.44772 8 5V13.0522C8 13.7579 7.28869 14.2398 6.6548 13.9296C5.79179 13.5074 4.97984 13.0247 4.23177 12.4853Z" fill="currentColor"/><path d="M31.7509 7.87572C30.9369 9.59547 29.584 11.1761 27.7682 12.4853C27.0202 13.0247 26.2082 13.5074 25.3452 13.9296C24.7113 14.2398 24 13.7579 24 13.0522L24 5C24 4.44772 24.4477 4 25 4L28.4821 4C30.78 4 32.7026 5.86498 31.7509 7.87572Z" fill="currentColor"/><path d="M16 16C14.564 16 13.1472 15.8662 11.7816 15.6082C11.3227 15.5215 11 15.1143 11 14.6473V5C11 4.44772 11.4477 4 12 4L20 4C20.5523 4 21 4.44772 21 5V14.6473C21 15.1143 20.6773 15.5215 20.2184 15.6082C18.8528 15.8662 17.436 16 16 16Z" fill="currentColor"/></g><defs><clipPath id="clip0_31_1134"><rect width="32" height="16" fill="white"/></clipPath></defs></svg>`,
39
39
  ];
40
40
 
41
- export const getColors = _.memoize((v: string) => {
41
+ export const getColors = memoize((v: string) => {
42
42
  const idx = Math.floor((cyrb53(v) / Math.pow(2, 53)) * colors.length);
43
43
  return colors[idx];
44
44
  });
45
45
 
46
- const getMouth = _.memoize((v: string) => {
46
+ const getMouth = memoize((v: string) => {
47
47
  const salted = v + "::mouth"; // made mouths independent of colors
48
48
  const idx = Math.floor((cyrb53(salted) / Math.pow(2, 53)) * mouths.length);
49
49
  return mouths[idx];
@@ -20,18 +20,27 @@ type Props = {
20
20
  label?: string;
21
21
  collapsible?: boolean;
22
22
  collapsed?: boolean;
23
+ collapsedDefault?: boolean;
23
24
  onCollapseChange?: (collapsed: boolean) => void;
24
25
  badge?: ReactNode;
25
26
  children: ReactNode;
26
27
  };
27
28
 
28
- export const FieldContainer = ({label, collapsible = false, collapsed, onCollapseChange, badge, children}: Props) => {
29
+ export const FieldContainer = ({
30
+ label,
31
+ collapsible = false,
32
+ collapsed,
33
+ collapsedDefault = true,
34
+ onCollapseChange,
35
+ badge,
36
+ children,
37
+ }: Props) => {
29
38
  return (
30
39
  <CollapsibleSection
31
40
  label={label ? <div className={labelStyle}>{label}</div> : undefined}
32
41
  collapsible={collapsible}
33
42
  collapsed={collapsed}
34
- collapsedDefault={true}
43
+ collapsedDefault={collapsedDefault}
35
44
  onCollapsedChange={onCollapseChange}
36
45
  badge={badge}
37
46
  >
@@ -4,11 +4,11 @@ import FileTable from "../icons/react/FileTable";
4
4
  import FileDocument from "../icons/react/FileDocument";
5
5
  import FileArchive from "../icons/react/FileArchive";
6
6
  import FilePresentation from "../icons/react/FilePresentation";
7
- import AppWiki from "../icons/react/AppWiki";
7
+ import FileOther from "../icons/react/FileOther";
8
8
 
9
9
  export function getFileIconComponent(contentType?: string) {
10
10
  if (!contentType) {
11
- return AppWiki;
11
+ return FileOther;
12
12
  }
13
13
  if (contentType.startsWith("image/")) {
14
14
  return FileImage;
@@ -29,7 +29,7 @@ export function getFileIconComponent(contentType?: string) {
29
29
  return FileDocument;
30
30
  }
31
31
 
32
- return AppWiki;
32
+ return FileOther;
33
33
  }
34
34
 
35
35
  export function FileIcon({contentType}: {contentType?: string}) {