@fibery/ui-kit 1.40.2 → 1.40.4
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.
- package/CHANGELOG.md +14 -0
- package/package.json +4 -7
- package/src/__snapshots__/design-system.test.ts.snap +7265 -0
- package/src/a11y-color.test.ts +181 -0
- package/src/a11y-color.ts +13 -20
- package/src/actions-menu/actions-menu-item.tsx +7 -7
- package/src/antd/ant-modal.tsx +10 -5
- package/src/antd/styles.ts +6 -6
- package/src/app-icon-with-fallback.tsx +2 -2
- package/src/app-icon.tsx +2 -2
- package/src/button/button.tsx +1 -0
- package/src/button/make-button-colors.ts +5 -13
- package/src/checkbox.tsx +2 -2
- package/src/color-picker/ColorPickerOrLoader.js +2 -2
- package/src/color-utils.test.ts +317 -0
- package/src/color-utils.ts +180 -0
- package/src/comment.tsx +3 -2
- package/src/context-menu/index.tsx +12 -7
- package/src/create-inline-theme.ts +9 -8
- package/src/design-system.colors.ts +760 -0
- package/src/design-system.test.ts +287 -7
- package/src/design-system.ts +146 -940
- package/src/dropdown-menu/index.tsx +21 -16
- package/src/emoji-picker/app-icon-picker.tsx +5 -5
- package/src/emoji-picker/emoji-picker-content-with-color.tsx +4 -4
- package/src/emoji-picker/icon-emoji-picker.tsx +2 -2
- package/src/favorites-icon.tsx +1 -1
- package/src/file-item/file-icon.tsx +169 -0
- package/src/file-item/file-menu-items.tsx +68 -0
- package/src/file-item/file-preview-actions.tsx +38 -0
- package/src/file-item/file-title.tsx +48 -0
- package/src/file-item/types.ts +27 -0
- package/src/file-item/use-register-in-image-gallery.tsx +70 -0
- package/src/file-item-2.tsx +35 -345
- package/src/file-item.tsx +6 -2
- package/src/hue-shift.test.ts +91 -0
- package/src/icons/Icon.tsx +1 -0
- package/src/icons/ast/FileCounter.ts +8 -0
- package/src/icons/ast/FileMultiple.ts +8 -0
- package/src/icons/ast/Print.ts +8 -0
- package/src/icons/ast/ValueEdit.ts +8 -0
- package/src/icons/ast/index.tsx +4 -0
- package/src/icons/react/Dividers.tsx +1 -1
- package/src/icons/react/FileCounter.tsx +13 -0
- package/src/icons/react/FileMultiple.tsx +13 -0
- package/src/icons/react/Print.tsx +13 -0
- package/src/icons/react/ValueEdit.tsx +13 -0
- package/src/icons/react/index.tsx +4 -0
- package/src/icons/svg/file-counter.svg +3 -0
- package/src/icons/svg/file-multiple.svg +3 -0
- package/src/icons/svg/print.svg +3 -0
- package/src/icons/svg/value-edit.svg +3 -0
- package/src/images-gallery/slide-buttons.tsx +4 -11
- package/src/lists/actions-menu-row-surface.tsx +5 -5
- package/src/mobile-keyboard-aware-popup.tsx +4 -3
- package/src/palette-generator.test.ts +566 -0
- package/src/palette-generator.ts +166 -0
- package/src/palette.ts +71 -55
- package/src/platform.ts +0 -3
- package/src/popover/index.tsx +20 -28
- package/src/progress.tsx +2 -2
- package/src/reactions/reaction-button.tsx +12 -6
- package/src/root-theme-provider.test.tsx +316 -0
- package/src/scale-generator.ts +347 -0
- package/src/select/components/menu-list-virtualized.tsx +7 -22
- package/src/select/components/menu.tsx +12 -2
- package/src/select/select.tsx +2 -1
- package/src/select/styles.ts +0 -1
- package/src/static-palettes.ts +146 -0
- package/src/thematic-color-picker.tsx +266 -0
- package/src/thematic-constants.tsx +27 -0
- package/src/thematic-controls.tsx +144 -0
- package/src/thematic-scales.tsx +122 -0
- package/src/thematic-state.ts +333 -0
- package/src/thematic.tsx +382 -0
- package/src/theme-provider.test.tsx +808 -0
- package/src/theme-provider.tsx +132 -69
- package/src/theme-settings.ts +1 -1
- package/src/theme-styles.ts +12 -5
- package/src/toast/toast-action.tsx +1 -1
- package/src/toggle-on-off.tsx +2 -2
- package/src/toggle.tsx +5 -6
- package/src/tooltip.tsx +13 -10
- package/src/type-badge.tsx +3 -3
- package/src/unit/styles.ts +2 -2
- package/src/unit/unit-with-tooltip.tsx +3 -2
- package/src/use-long-press.tsx +2 -2
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import {a11yColor} from "./a11y-color";
|
|
2
|
+
|
|
3
|
+
describe("a11yColor", () => {
|
|
4
|
+
describe("returns original color when", () => {
|
|
5
|
+
it("color already passes contrast on light background", () => {
|
|
6
|
+
// Dark blue on white should already pass
|
|
7
|
+
const result = a11yColor("#000080", "#ffffff");
|
|
8
|
+
expect(result).toMatchInlineSnapshot(`"rgb(0,0,128)"`);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("color already passes contrast on dark background", () => {
|
|
12
|
+
// White on black should already pass
|
|
13
|
+
const result = a11yColor("#ffffff", "#000000");
|
|
14
|
+
expect(result).toBe("rgb(255,255,255)");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("invalid toMakeA11y color is provided", () => {
|
|
18
|
+
const result = a11yColor("invalid-color", "#ffffff");
|
|
19
|
+
expect(result).toBe("invalid-color");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("invalid background color is provided", () => {
|
|
23
|
+
const result = a11yColor("#ff0000", "invalid-bg");
|
|
24
|
+
expect(result).toBe("#ff0000");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("transparent is provided as toMakeA11y", () => {
|
|
28
|
+
const result = a11yColor("transparent", "#ffffff");
|
|
29
|
+
expect(result).toBe("transparent");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("transparent is provided as background", () => {
|
|
33
|
+
const result = a11yColor("#ff0000", "transparent");
|
|
34
|
+
expect(result).toBe("#ff0000");
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe("adjusts colors for contrast", () => {
|
|
39
|
+
it("makes light color darker on white background", () => {
|
|
40
|
+
// Light yellow on white needs to be darker
|
|
41
|
+
const result = a11yColor("#ffff00", "#ffffff");
|
|
42
|
+
expect(result).toMatchInlineSnapshot(`"rgb(154,154,0)"`);
|
|
43
|
+
// Result should be different (darker) than input
|
|
44
|
+
expect(result).not.toBe("rgb(255,255,0)");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("makes dark color lighter on black background", () => {
|
|
48
|
+
// Dark blue on black needs to be lighter
|
|
49
|
+
const result = a11yColor("#000033", "#000000");
|
|
50
|
+
expect(result).toMatchInlineSnapshot(`"rgb(49,49,255)"`);
|
|
51
|
+
// Result should be different (lighter) than input
|
|
52
|
+
expect(result).not.toBe("rgb(0,0,51)");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("handles medium colors on light backgrounds", () => {
|
|
56
|
+
// Medium gray on white
|
|
57
|
+
const result = a11yColor("#808080", "#ffffff");
|
|
58
|
+
expect(result).toMatchInlineSnapshot(`"rgb(128,128,128)"`);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("handles medium colors on dark backgrounds", () => {
|
|
62
|
+
// Medium gray on black
|
|
63
|
+
const result = a11yColor("#808080", "#000000");
|
|
64
|
+
expect(result).toMatchInlineSnapshot(`"rgb(128,128,128)"`);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
describe("respects minimum contrast ratio", () => {
|
|
69
|
+
it("uses default 3.0 contrast ratio", () => {
|
|
70
|
+
const result = a11yColor("#cccccc", "#ffffff");
|
|
71
|
+
expect(result).toMatchInlineSnapshot(`"rgb(148,148,148)"`);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("adjusts for higher contrast ratio (4.5 WCAG AA)", () => {
|
|
75
|
+
const result = a11yColor("#cccccc", "#ffffff", 4.5);
|
|
76
|
+
expect(result).toMatchInlineSnapshot(`"rgb(118,118,118)"`);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("adjusts for highest contrast ratio (7.0 WCAG AAA)", () => {
|
|
80
|
+
const result = a11yColor("#cccccc", "#ffffff", 7.0);
|
|
81
|
+
expect(result).toMatchInlineSnapshot(`"rgb(89,89,89)"`);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe("handles various color formats", () => {
|
|
86
|
+
it("handles 3-digit hex colors", () => {
|
|
87
|
+
const result = a11yColor("#f00", "#fff");
|
|
88
|
+
expect(result).toMatchInlineSnapshot(`"rgb(255,0,0)"`);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("handles 6-digit hex colors", () => {
|
|
92
|
+
const result = a11yColor("#ff0000", "#ffffff");
|
|
93
|
+
expect(result).toMatchInlineSnapshot(`"rgb(255,0,0)"`);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("handles rgb() colors", () => {
|
|
97
|
+
const result = a11yColor("rgb(255, 0, 0)", "#ffffff");
|
|
98
|
+
expect(result).toMatchInlineSnapshot(`"rgb(255,0,0)"`);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("handles named colors", () => {
|
|
102
|
+
const result = a11yColor("red", "white");
|
|
103
|
+
expect(result).toMatchInlineSnapshot(`"rgb(255,0,0)"`);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("handles hsl() colors", () => {
|
|
107
|
+
const result = a11yColor("hsl(0, 100%, 50%)", "#ffffff");
|
|
108
|
+
expect(result).toMatchInlineSnapshot(`"rgb(255,0,0)"`);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe("caching", () => {
|
|
113
|
+
it("returns same result for same inputs", () => {
|
|
114
|
+
const result1 = a11yColor("#ff0000", "#ffffff");
|
|
115
|
+
const result2 = a11yColor("#ff0000", "#ffffff");
|
|
116
|
+
expect(result1).toBe(result2);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("returns different results for different contrast ratios", () => {
|
|
120
|
+
const result1 = a11yColor("#cccccc", "#ffffff", 3.0);
|
|
121
|
+
const result2 = a11yColor("#cccccc", "#ffffff", 7.0);
|
|
122
|
+
// Higher contrast requirement may produce different result
|
|
123
|
+
expect(result1).not.toBe(result2);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
describe("real-world use cases", () => {
|
|
128
|
+
it("brand green on white background", () => {
|
|
129
|
+
const result = a11yColor("#69AC5E", "#ffffff");
|
|
130
|
+
expect(result).toMatchInlineSnapshot(`"rgb(96,164,85)"`);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("brand blue on white background", () => {
|
|
134
|
+
const result = a11yColor("#4978D4", "#ffffff");
|
|
135
|
+
expect(result).toMatchInlineSnapshot(`"rgb(73,120,212)"`);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("light text on dark theme background", () => {
|
|
139
|
+
const result = a11yColor("#aaaaaa", "#1a1a1a");
|
|
140
|
+
expect(result).toMatchInlineSnapshot(`"rgb(170,170,170)"`);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it("card type colors on white", () => {
|
|
144
|
+
const cardColors = [
|
|
145
|
+
"#F0D0DD",
|
|
146
|
+
"#F5D3CA",
|
|
147
|
+
"#FAE0B7",
|
|
148
|
+
"#FCEAA2",
|
|
149
|
+
"#E3ECAB",
|
|
150
|
+
"#CFEFC8",
|
|
151
|
+
"#C1F3DF",
|
|
152
|
+
"#C1EDF5",
|
|
153
|
+
"#C1E0F5",
|
|
154
|
+
"#C7D6F9",
|
|
155
|
+
"#D8D3F5",
|
|
156
|
+
"#E8D1EF",
|
|
157
|
+
"#E6DFDA",
|
|
158
|
+
"#D2D2D2",
|
|
159
|
+
"#FFFF8D",
|
|
160
|
+
];
|
|
161
|
+
|
|
162
|
+
expect(cardColors.map((color) => a11yColor(color, "#ffffff"))).toEqual([
|
|
163
|
+
"rgb(212,120,158)",
|
|
164
|
+
"rgb(224,119,91)",
|
|
165
|
+
"rgb(207,132,14)",
|
|
166
|
+
"rgb(180,145,6)",
|
|
167
|
+
"rgb(140,157,36)",
|
|
168
|
+
"rgb(71,169,49)",
|
|
169
|
+
"rgb(33,169,115)",
|
|
170
|
+
"rgb(30,162,186)",
|
|
171
|
+
"rgb(57,156,223)",
|
|
172
|
+
"rgb(107,146,239)",
|
|
173
|
+
"rgb(150,137,228)",
|
|
174
|
+
"rgb(189,124,209)",
|
|
175
|
+
"rgb(169,144,127)",
|
|
176
|
+
"rgb(148,148,148)",
|
|
177
|
+
"rgb(154,154,0)",
|
|
178
|
+
]);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
});
|
package/src/a11y-color.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// https://github.com/alex-page/a11ycolor
|
|
2
|
-
import
|
|
2
|
+
import {fromHSL, getContrastRatio, getHsl, isValidColor, toCss} from "./color-utils";
|
|
3
3
|
|
|
4
4
|
class LRUCache<TKey, TValue> {
|
|
5
5
|
#capacity: number;
|
|
@@ -41,12 +41,7 @@ const checkColor = (colorValue: string) => {
|
|
|
41
41
|
if (colorValue === "transparent") {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
return chroma.valid(colorValue);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
44
|
+
return isValidColor(colorValue);
|
|
50
45
|
};
|
|
51
46
|
|
|
52
47
|
/**
|
|
@@ -58,10 +53,10 @@ const checkColor = (colorValue: string) => {
|
|
|
58
53
|
*
|
|
59
54
|
* @return {string} - The closest hex color for `toMakeA11y` on `background`
|
|
60
55
|
*/
|
|
61
|
-
export function a11yColor(toMakeA11y: string, background: string, minimumContrast = 3.0) {
|
|
56
|
+
export function a11yColor(toMakeA11y: string, background: string, minimumContrast = 3.0): string {
|
|
62
57
|
const key = toMakeA11y + background + minimumContrast;
|
|
63
58
|
if (cache.has(key)) {
|
|
64
|
-
return cache.get(key)
|
|
59
|
+
return cache.get(key)!;
|
|
65
60
|
}
|
|
66
61
|
if (!checkColor(toMakeA11y) || !checkColor(background)) {
|
|
67
62
|
cache.put(key, toMakeA11y);
|
|
@@ -71,23 +66,21 @@ export function a11yColor(toMakeA11y: string, background: string, minimumContras
|
|
|
71
66
|
if (minimumContrast < 0 && minimumContrast > 21) {
|
|
72
67
|
throw new Error(`Minimum contrast must be a number between 0 and 21. It was ${minimumContrast}`);
|
|
73
68
|
}
|
|
74
|
-
const a11y = chroma(toMakeA11y);
|
|
75
|
-
const bg = chroma(background);
|
|
76
69
|
|
|
77
70
|
// Check the ratio straight away, if it passes return the value as hex
|
|
78
|
-
if (
|
|
79
|
-
const val =
|
|
71
|
+
if (getContrastRatio(background, toMakeA11y) >= minimumContrast) {
|
|
72
|
+
const val = toCss(toMakeA11y);
|
|
80
73
|
cache.put(key, val);
|
|
81
74
|
return val;
|
|
82
75
|
}
|
|
83
76
|
|
|
84
77
|
// Ratio didn't pass so we need to find the nearest color
|
|
85
|
-
const a11yHSL =
|
|
78
|
+
const a11yHSL = getHsl(toMakeA11y);
|
|
86
79
|
const a11yLightness = a11yHSL[2] * 100;
|
|
87
80
|
const minHexDiff = 100 / 255; // 255 Colors / 100% HSL
|
|
88
81
|
|
|
89
|
-
const isBlackBgContrast =
|
|
90
|
-
const isWhiteBgContrast =
|
|
82
|
+
const isBlackBgContrast = getContrastRatio(background, "#000") >= minimumContrast;
|
|
83
|
+
const isWhiteBgContrast = getContrastRatio(background, "#FFF") >= minimumContrast;
|
|
91
84
|
let minLightness = 0;
|
|
92
85
|
let maxLightness = 100;
|
|
93
86
|
let isDarkColor = false;
|
|
@@ -117,19 +110,19 @@ export function a11yColor(toMakeA11y: string, background: string, minimumContras
|
|
|
117
110
|
// Binary search until we find the colour that meets contrast
|
|
118
111
|
while (!foundColor) {
|
|
119
112
|
const midLightness = (minLightness + maxLightness) / 2;
|
|
120
|
-
const
|
|
113
|
+
const midA11yHex = fromHSL(a11yHSL[0], a11yHSL[1], midLightness / 100);
|
|
121
114
|
|
|
122
115
|
// Give up if we are stuck
|
|
123
116
|
if (Math.abs(maxLightness - minLightness) < 0.01) {
|
|
124
|
-
foundColor =
|
|
117
|
+
foundColor = midA11yHex;
|
|
125
118
|
break;
|
|
126
119
|
}
|
|
127
120
|
|
|
128
121
|
// The colour meets contrast
|
|
129
|
-
if (
|
|
122
|
+
if (getContrastRatio(midA11yHex, background) >= minimumContrast) {
|
|
130
123
|
// It is the minimal lightness range for one hexadecimal
|
|
131
124
|
if (maxLightness - minLightness <= minHexDiff) {
|
|
132
|
-
foundColor =
|
|
125
|
+
foundColor = midA11yHex;
|
|
133
126
|
} else if (isDarkColor) {
|
|
134
127
|
// If it is going to be a dark color move the min to mid
|
|
135
128
|
minLightness = midLightness;
|
|
@@ -2,7 +2,7 @@ import {stopPropagation} from "@fibery/react/src/stop-propagation";
|
|
|
2
2
|
import {useCallbackRef} from "@fibery/react/src/use-callback-ref";
|
|
3
3
|
import {css, cx} from "@linaria/core";
|
|
4
4
|
import {FunctionComponent, memo, ReactNode, useId} from "react";
|
|
5
|
-
import {border,
|
|
5
|
+
import {border, layout, layoutVars, lineHeight, space, textStyles, themeVars} from "../design-system";
|
|
6
6
|
import CheckedIcon from "../icons/react/Checked";
|
|
7
7
|
import {IconBaseProps} from "../icons/types";
|
|
8
8
|
import {Spinner} from "../loaders";
|
|
@@ -41,7 +41,7 @@ const rowCss = css`
|
|
|
41
41
|
}
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
|
-
const dangerousItemCss = css`
|
|
44
|
+
export const dangerousItemCss = css`
|
|
45
45
|
&.${rowCss} {
|
|
46
46
|
&[data-highlighted] {
|
|
47
47
|
color: ${themeVars.danger};
|
|
@@ -52,21 +52,21 @@ const dangerousItemCss = css`
|
|
|
52
52
|
}
|
|
53
53
|
`;
|
|
54
54
|
|
|
55
|
-
const dangerousConfirmationCss = css`
|
|
55
|
+
export const dangerousConfirmationCss = css`
|
|
56
56
|
&.${rowCss} {
|
|
57
57
|
background-color: ${themeVars.colorBgActionsMenuItemDangerActive};
|
|
58
|
-
color: ${
|
|
58
|
+
color: ${themeVars.inversedTextColor};
|
|
59
59
|
border-radius: ${border.radius6}px;
|
|
60
60
|
|
|
61
|
-
--actions-menu-item-icon-color: ${
|
|
61
|
+
--actions-menu-item-icon-color: ${themeVars.inversedTextColor};
|
|
62
62
|
|
|
63
63
|
&:hover,
|
|
64
64
|
&[data-highlighted] {
|
|
65
65
|
background-color: ${themeVars.colorBgActionsMenuItemDangerActive};
|
|
66
|
-
color: ${
|
|
66
|
+
color: ${themeVars.inversedTextColor};
|
|
67
67
|
border-radius: ${border.radius6}px;
|
|
68
68
|
|
|
69
|
-
--actions-menu-item-icon-color: ${
|
|
69
|
+
--actions-menu-item-icon-color: ${themeVars.inversedTextColor};
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
`;
|
package/src/antd/ant-modal.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import Modal from "antd/lib/modal";
|
|
2
2
|
import {ModalProps} from "antd/lib/modal/Modal";
|
|
3
3
|
import "antd/lib/modal/style/css";
|
|
4
|
-
import {border,
|
|
5
|
-
import {
|
|
4
|
+
import {border, space, themeVars} from "../design-system";
|
|
5
|
+
import {ThemeProvider} from "../theme-provider";
|
|
6
6
|
import {css, cx} from "@linaria/core";
|
|
7
|
+
import {ReactNode} from "react";
|
|
7
8
|
|
|
8
9
|
const modalCss = css`
|
|
9
10
|
& .ant-modal-content {
|
|
@@ -19,8 +20,12 @@ const modalCss = css`
|
|
|
19
20
|
}
|
|
20
21
|
`;
|
|
21
22
|
|
|
23
|
+
function renderWithTheme(node: ReactNode): ReactNode {
|
|
24
|
+
return <ThemeProvider portal>{node}</ThemeProvider>;
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
export function AntModal({bodyStyle = {}, className, ...restProps}: ModalProps) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
return (
|
|
29
|
+
<Modal bodyStyle={bodyStyle} className={cx(className, modalCss)} modalRender={renderWithTheme} {...restProps} />
|
|
30
|
+
);
|
|
26
31
|
}
|
package/src/antd/styles.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
|
-
import {border,
|
|
2
|
+
import {border, layout, shadows, space, textStyles, themeVars, transition} from "../design-system";
|
|
3
3
|
|
|
4
4
|
const inputVariables = {
|
|
5
5
|
default: {
|
|
@@ -30,7 +30,7 @@ export const inputOverrides = {
|
|
|
30
30
|
paddingLeft: space.s12,
|
|
31
31
|
paddingRight: space.s12,
|
|
32
32
|
border: 0,
|
|
33
|
-
borderColor:
|
|
33
|
+
borderColor: themeVars.transparent,
|
|
34
34
|
transition: `box-shadow ${transition}`,
|
|
35
35
|
boxShadow: `var(--input-border, ${themeVars.inputBorderColor})`,
|
|
36
36
|
letterSpacing: 0,
|
|
@@ -49,7 +49,7 @@ export const inputOverrides = {
|
|
|
49
49
|
disabled: {
|
|
50
50
|
color: `${themeVars.textColor}`,
|
|
51
51
|
backgroundColor: `${themeVars.inputDisabledBgColor} !important`,
|
|
52
|
-
borderColor:
|
|
52
|
+
borderColor: themeVars.transparent,
|
|
53
53
|
boxShadow: `${themeVars.inputDisabledBorderColor} !important`,
|
|
54
54
|
transition: `box-shadow ${transition}`,
|
|
55
55
|
WebkitTextFillColor: "currentColor",
|
|
@@ -69,7 +69,7 @@ export const inputStyles = css`
|
|
|
69
69
|
${{
|
|
70
70
|
...textStyles.regular,
|
|
71
71
|
"& .ant-input-group-addon": {
|
|
72
|
-
backgroundColor:
|
|
72
|
+
backgroundColor: themeVars.transparent,
|
|
73
73
|
border: "none",
|
|
74
74
|
padding: 0,
|
|
75
75
|
textAlign: "left",
|
|
@@ -93,7 +93,7 @@ export const inputStyles = css`
|
|
|
93
93
|
padding: 0,
|
|
94
94
|
border: "none",
|
|
95
95
|
boxShadow: "none",
|
|
96
|
-
backgroundColor:
|
|
96
|
+
backgroundColor: themeVars.transparent,
|
|
97
97
|
},
|
|
98
98
|
"& .ant-input-affix-wrapper.ant-input-affix-wrapper-readonly": {
|
|
99
99
|
border: "none !important",
|
|
@@ -118,7 +118,7 @@ export const inputStyles = css`
|
|
|
118
118
|
paddingBottom: space.s8,
|
|
119
119
|
},
|
|
120
120
|
"& .ant-select-disabled .ant-select-selection": {
|
|
121
|
-
backgroundColor:
|
|
121
|
+
backgroundColor: themeVars.transparent,
|
|
122
122
|
},
|
|
123
123
|
"&& input:hover:not(:focus):not(:disabled), && textarea:hover:not(:focus):not(:disabled), && .ant-input:hover:not(:focus):not(:disabled)":
|
|
124
124
|
inputOverrides.hover,
|
|
@@ -3,7 +3,7 @@ import _ from "lodash";
|
|
|
3
3
|
import {FC, Suspense, lazy} from "react";
|
|
4
4
|
import {a11yColor} from "./a11y-color";
|
|
5
5
|
import {AppIconWrapper} from "./app-icon-wrapper";
|
|
6
|
-
import {
|
|
6
|
+
import {getOpacities, getThemeValue, iconSize, layout} from "./design-system";
|
|
7
7
|
import {Icon} from "./icons/Icon";
|
|
8
8
|
import {useTheme} from "./theme-provider";
|
|
9
9
|
import {useIsPhone} from "./use-is-phone";
|
|
@@ -134,7 +134,7 @@ export const AppIcon: FC<AppIconProps> = ({icon, color, isSelected, ...rest}) =>
|
|
|
134
134
|
light2: a11yColor(getOpacities(color).opacity95, theme.menuBg, 5),
|
|
135
135
|
});
|
|
136
136
|
|
|
137
|
-
const bgColor =
|
|
137
|
+
const bgColor = theme.fns.getAppIconBackground(color);
|
|
138
138
|
|
|
139
139
|
return (
|
|
140
140
|
<AppIconWrapper color={bgColor as string} borderless={isSelected} containerSize={containerSize}>
|
package/src/app-icon.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import cx from "classnames";
|
|
|
3
3
|
import {FC} from "react";
|
|
4
4
|
import {a11yColor} from "./a11y-color";
|
|
5
5
|
import {AppIconWithFallback} from "./app-icon-with-fallback";
|
|
6
|
-
import {border,
|
|
6
|
+
import {border, getOpacities, getThemeValue} from "./design-system";
|
|
7
7
|
import {useTheme} from "./theme-provider";
|
|
8
8
|
|
|
9
9
|
interface AppIconProps {
|
|
@@ -22,7 +22,7 @@ export const AppIcon: FC<AppIconProps> = ({color, icon, containerSize = 54, icon
|
|
|
22
22
|
light2: a11yColor(getOpacities(color).opacity95, theme.menuBg, 5),
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
const bgColor =
|
|
25
|
+
const bgColor = theme.fns.getAppIconBackground(color);
|
|
26
26
|
|
|
27
27
|
const appIconGradientStyle = getThemeValue(theme.mode, {
|
|
28
28
|
dark: "linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0))",
|
package/src/button/button.tsx
CHANGED
|
@@ -3,18 +3,10 @@
|
|
|
3
3
|
// so it's easier to find buttons with custom colors
|
|
4
4
|
|
|
5
5
|
import {CSSProperties} from "@linaria/core";
|
|
6
|
-
import {
|
|
7
|
-
getDarkenColor,
|
|
8
|
-
getEnumBackgroundColor,
|
|
9
|
-
getIconColor,
|
|
10
|
-
getOpacities,
|
|
11
|
-
getThemeValue,
|
|
12
|
-
themeVars,
|
|
13
|
-
} from "../design-system";
|
|
6
|
+
import {getDarkenColor, getOpacities, getThemeValue, ThemeColors, themeVars} from "../design-system";
|
|
14
7
|
import {ButtonVariant} from "./base-button";
|
|
15
|
-
import {ThemeMode} from "../theme-settings";
|
|
16
8
|
|
|
17
|
-
export const makeButtonColors = (color: string, variant: ButtonVariant,
|
|
9
|
+
export const makeButtonColors = (color: string, variant: ButtonVariant, theme: ThemeColors): CSSProperties => {
|
|
18
10
|
switch (variant) {
|
|
19
11
|
case "solid":
|
|
20
12
|
return {
|
|
@@ -43,12 +35,12 @@ export const makeButtonColors = (color: string, variant: ButtonVariant, mode: Th
|
|
|
43
35
|
};
|
|
44
36
|
default:
|
|
45
37
|
case "soft": {
|
|
46
|
-
const bgColor =
|
|
47
|
-
const textColor = getIconColor(
|
|
38
|
+
const bgColor = theme.fns.getEnumBackground(color) as string;
|
|
39
|
+
const textColor = theme.fns.getIconColor(color) as string;
|
|
48
40
|
|
|
49
41
|
return {
|
|
50
42
|
"--fibery-button-color": bgColor,
|
|
51
|
-
"--fibery-button-hover-color": getThemeValue(mode, {
|
|
43
|
+
"--fibery-button-hover-color": getThemeValue(theme.mode, {
|
|
52
44
|
light: getOpacities(color).opacity30,
|
|
53
45
|
dark: getOpacities(color).opacity45,
|
|
54
46
|
}),
|
package/src/checkbox.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
useEffect,
|
|
13
13
|
useRef,
|
|
14
14
|
} from "react";
|
|
15
|
-
import {
|
|
15
|
+
import {getDarkenColor, getOpacities, layout, space, textStyles, ThemeColors, themeVars} from "./design-system";
|
|
16
16
|
import {smallHtmlStylesClass} from "./html-styles";
|
|
17
17
|
import {mobileRootSelector} from "./mobile-styles";
|
|
18
18
|
|
|
@@ -127,7 +127,7 @@ const checkmarkStyle = css`
|
|
|
127
127
|
opacity: 0;
|
|
128
128
|
transition: transform 0.2s, opacity 0.2s;
|
|
129
129
|
pointer-events: none;
|
|
130
|
-
color: ${
|
|
130
|
+
color: ${themeVars.inversedTextColor};
|
|
131
131
|
width: ${layout.checkboxSize}px;
|
|
132
132
|
height: ${layout.checkboxSize}px;
|
|
133
133
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {colors, border, space} from "../design-system";
|
|
2
1
|
import {css} from "@linaria/core";
|
|
3
2
|
import {lazy, Suspense} from "react";
|
|
3
|
+
import {border, space, themeVars} from "../design-system";
|
|
4
4
|
|
|
5
5
|
const colorPickerLoaderStyle = css`
|
|
6
6
|
${{
|
|
7
|
-
backgroundColor:
|
|
7
|
+
backgroundColor: themeVars.inversedTextColor,
|
|
8
8
|
borderRadius: border.radius4,
|
|
9
9
|
boxShadow: "rgba(0, 0, 0, 0.15) 0px 0px 0px 1px, rgba(0, 0, 0, 0.15) 0px 8px 16px",
|
|
10
10
|
padding: space.s12,
|