@qoretechnologies/reqore 0.28.1 → 0.28.2
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/__tests__/effect.test.tsx +6 -6
- package/dist/components/Button/index.d.ts +3 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +2 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +1 -2
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Effect/index.d.ts +14 -6
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +32 -20
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +1 -2
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +2 -2
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Menu/divider.js +1 -4
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Menu/index.d.ts +3 -2
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +11 -7
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +4 -1
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +4 -2
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tag/index.d.ts +3 -1
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +11 -5
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts +1 -0
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +2 -2
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/constants/colors.js +1 -1
- package/dist/constants/theme.d.ts +43 -42
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/constants/theme.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +1 -1
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/helpers/colors.d.ts +11 -10
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +34 -10
- package/dist/helpers/colors.js.map +1 -1
- package/dist/hooks/useTheme.d.ts +9 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useTheme.js +7 -0
- package/dist/hooks/useTheme.js.map +1 -1
- package/dist/types/global.d.ts +13 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +13 -5
- package/src/components/Dropdown/list.tsx +0 -2
- package/src/components/Effect/index.tsx +64 -19
- package/src/components/Header/index.tsx +1 -3
- package/src/components/Input/index.tsx +3 -0
- package/src/components/InternalPopover/index.tsx +2 -1
- package/src/components/Menu/divider.tsx +1 -1
- package/src/components/Menu/index.tsx +16 -7
- package/src/components/Message/index.tsx +4 -1
- package/src/components/Panel/index.tsx +1 -1
- package/src/components/Table/row.tsx +8 -5
- package/src/components/Tag/index.tsx +18 -6
- package/src/components/Textarea/index.tsx +3 -0
- package/src/constants/colors.ts +1 -1
- package/src/constants/theme.ts +44 -42
- package/src/containers/UIProvider.tsx +1 -1
- package/src/helpers/colors.ts +58 -26
- package/src/hooks/useTheme.ts +20 -3
- package/src/stories/Button/Button.stories.tsx +1 -1
- package/src/stories/Menu/Menu.stories.tsx +50 -3
- package/src/stories/Message/Message.stories.tsx +3 -4
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/helpers/colors.ts"],"names":[],"mappings":"
|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uBAAuB,UAC3B,YAAY,SACZ,kBAAkB,KACxB,eAqCF,CAAC"}
|
package/dist/helpers/colors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.
|
|
3
|
+
exports.getColorFromMaybeString = exports.getMainBackgroundColor = exports.getNotificationIntent = exports.mergeThemes = exports.buildTheme = exports.isValidSixCharHex = exports.getColorByBgColor = exports.changeDarkness = exports.changeLightness = exports.getMainColor = exports.shouldDarken = exports.percentToHexAlpha = exports.getReadableColorFrom = exports.getReadableColor = void 0;
|
|
4
4
|
var lodash_1 = require("lodash");
|
|
5
5
|
var polished_1 = require("polished");
|
|
6
6
|
var colors_1 = require("../constants/colors");
|
|
@@ -49,7 +49,11 @@ var changeLightness = function (color, lightness) {
|
|
|
49
49
|
};
|
|
50
50
|
exports.changeLightness = changeLightness;
|
|
51
51
|
var changeDarkness = function (color, lightness) {
|
|
52
|
-
return lightness
|
|
52
|
+
return lightness
|
|
53
|
+
? (0, exports.shouldDarken)(color)
|
|
54
|
+
? (0, polished_1.lighten)(lightness, color)
|
|
55
|
+
: (0, polished_1.darken)(lightness, color)
|
|
56
|
+
: color;
|
|
53
57
|
};
|
|
54
58
|
exports.changeDarkness = changeDarkness;
|
|
55
59
|
var getColorByBgColor = function (bgColor) {
|
|
@@ -60,7 +64,7 @@ var getColorByBgColor = function (bgColor) {
|
|
|
60
64
|
};
|
|
61
65
|
exports.getColorByBgColor = getColorByBgColor;
|
|
62
66
|
var isValidSixCharHex = function (hex) {
|
|
63
|
-
return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(hex);
|
|
67
|
+
return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$/.test(hex);
|
|
64
68
|
};
|
|
65
69
|
exports.isValidSixCharHex = isValidSixCharHex;
|
|
66
70
|
var buildTheme = function (theme) {
|
|
@@ -121,14 +125,34 @@ var getMainBackgroundColor = function (theme) {
|
|
|
121
125
|
return (0, exports.changeLightness)(theme.main, 0.02);
|
|
122
126
|
};
|
|
123
127
|
exports.getMainBackgroundColor = getMainBackgroundColor;
|
|
124
|
-
var
|
|
125
|
-
if (
|
|
126
|
-
return
|
|
128
|
+
var getColorFromMaybeString = function (theme, color) {
|
|
129
|
+
if (!color) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
var _a = color.split(':'), providedColor = _a[0], shading = _a[1], _b = _a[2], multiplier = _b === void 0 ? 1 : _b;
|
|
133
|
+
if (providedColor === 'transparent') {
|
|
134
|
+
return '#00000000';
|
|
135
|
+
}
|
|
136
|
+
// First we need to get the actual color
|
|
137
|
+
var _color;
|
|
138
|
+
if (!providedColor || providedColor === 'main') {
|
|
139
|
+
_color = theme.main;
|
|
140
|
+
}
|
|
141
|
+
if (theme.intents[providedColor]) {
|
|
142
|
+
_color = theme.intents[providedColor];
|
|
143
|
+
}
|
|
144
|
+
if ((0, exports.isValidSixCharHex)(color)) {
|
|
145
|
+
_color = providedColor;
|
|
127
146
|
}
|
|
128
|
-
if (
|
|
129
|
-
|
|
147
|
+
if (shading) {
|
|
148
|
+
if (shading === 'lighten') {
|
|
149
|
+
_color = (0, polished_1.lighten)(0.1 * multiplier, _color);
|
|
150
|
+
}
|
|
151
|
+
else if (shading === 'darken') {
|
|
152
|
+
_color = (0, polished_1.darken)(0.1 * multiplier, _color);
|
|
153
|
+
}
|
|
130
154
|
}
|
|
131
|
-
return
|
|
155
|
+
return _color;
|
|
132
156
|
};
|
|
133
|
-
exports.
|
|
157
|
+
exports.getColorFromMaybeString = getColorFromMaybeString;
|
|
134
158
|
//# sourceMappingURL=colors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/helpers/colors.ts"],"names":[],"mappings":";;;AAAA,iCAA0C;AAC1C,qCAA0D;
|
|
1
|
+
{"version":3,"file":"colors.js","sourceRoot":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GAAG,KAAK,CAAC,IAAI,CAAC;KACrB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QAChC,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;KACvC;IAED,IAAI,IAAA,yBAAiB,EAAC,KAAK,CAAC,EAAE;QAC5B,MAAM,GAAG,aAAgC,CAAC;KAC3C;IAED,IAAI,OAAO,EAAE;QACX,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,MAAM,GAAG,IAAA,kBAAO,EAAC,GAAG,GAAG,UAAU,EAAE,MAAM,CAAoB,CAAC;SAC/D;aAAM,IAAI,OAAO,KAAK,QAAQ,EAAE;YAC/B,MAAM,GAAG,IAAA,iBAAM,EAAC,GAAG,GAAG,UAAU,EAAE,MAAM,CAAoB,CAAC;SAC9D;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAxCW,QAAA,uBAAuB,2BAwClC"}
|
package/dist/hooks/useTheme.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { TReqoreEffectColor } from '../components/Effect';
|
|
1
2
|
import { IReqoreTheme, TReqoreIntent } from '../constants/theme';
|
|
2
|
-
export
|
|
3
|
+
export interface IReqoreCustomTheme extends Partial<Omit<IReqoreTheme, 'main' | 'text'>> {
|
|
4
|
+
main?: TReqoreEffectColor;
|
|
5
|
+
text?: {
|
|
6
|
+
color?: TReqoreEffectColor;
|
|
7
|
+
dim?: boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare const useReqoreTheme: (element: string, customTheme?: IReqoreCustomTheme, intent?: TReqoreIntent) => IReqoreTheme;
|
|
3
11
|
//# sourceMappingURL=useTheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIjE,eAAO,MAAM,cAAc,YAChB,MAAM,gBACF,
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIjE,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACtF,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,kBAAkB,CAAC;QAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;KACf,CAAC;CACH;AAED,eAAO,MAAM,cAAc,YAChB,MAAM,gBACF,kBAAkB,WACtB,aAAa,iBAkBvB,CAAC"}
|
package/dist/hooks/useTheme.js
CHANGED
|
@@ -9,9 +9,16 @@ var react_1 = require("react");
|
|
|
9
9
|
var ThemeContext_1 = __importDefault(require("../context/ThemeContext"));
|
|
10
10
|
var colors_1 = require("../helpers/colors");
|
|
11
11
|
var useReqoreTheme = function (element, customTheme, intent) {
|
|
12
|
+
var _a;
|
|
12
13
|
if (customTheme === void 0) { customTheme = {}; }
|
|
13
14
|
var theme = (0, react_1.useContext)(ThemeContext_1["default"]);
|
|
14
15
|
var _customTheme = (0, lodash_1.cloneDeep)(customTheme);
|
|
16
|
+
if (_customTheme.main) {
|
|
17
|
+
_customTheme.main = (0, colors_1.getColorFromMaybeString)(theme, customTheme.main);
|
|
18
|
+
}
|
|
19
|
+
if ((_a = _customTheme.text) === null || _a === void 0 ? void 0 : _a.color) {
|
|
20
|
+
_customTheme.text.color = (0, colors_1.getColorFromMaybeString)(theme, customTheme.text.color);
|
|
21
|
+
}
|
|
15
22
|
if (element === 'main' && intent) {
|
|
16
23
|
_customTheme.main = theme.intents[intent];
|
|
17
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../../src/hooks/useTheme.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAmC;AACnC,+BAAmC;
|
|
1
|
+
{"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../../src/hooks/useTheme.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAmC;AACnC,+BAAmC;AAGnC,yEAAmD;AACnD,4CAAyE;AAUlE,IAAM,cAAc,GAAG,UAC5B,OAAe,EACf,WAAoC,EACpC,MAAsB;;IADtB,4BAAA,EAAA,gBAAoC;IAGpC,IAAM,KAAK,GAAiB,IAAA,kBAAU,EAAe,yBAAY,CAAC,CAAC;IACnE,IAAI,YAAY,GAAuB,IAAA,kBAAS,EAAC,WAAW,CAAC,CAAC;IAE9D,IAAI,YAAY,CAAC,IAAI,EAAE;QACrB,YAAY,CAAC,IAAI,GAAG,IAAA,gCAAuB,EAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;KACtE;IAED,IAAI,MAAA,YAAY,CAAC,IAAI,0CAAE,KAAK,EAAE;QAC5B,YAAY,CAAC,IAAI,CAAC,KAAK,GAAG,IAAA,gCAAuB,EAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAClF;IAED,IAAI,OAAO,KAAK,MAAM,IAAI,MAAM,EAAE;QAChC,YAAY,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KAC3C;IAED,OAAO,IAAA,oBAAW,EAAC,OAAO,EAAE,KAAK,EAAE,YAAY,CAAiB,CAAC;AACnE,CAAC,CAAC;AArBW,QAAA,cAAc,kBAqBzB"}
|
package/dist/types/global.d.ts
CHANGED
|
@@ -129,6 +129,19 @@ export interface IWithReqoreMinimal {
|
|
|
129
129
|
*/
|
|
130
130
|
minimal?: boolean;
|
|
131
131
|
}
|
|
132
|
+
export interface IWithReqoreTransparent {
|
|
133
|
+
/**
|
|
134
|
+
* If true, the component will be transparent
|
|
135
|
+
* @default false
|
|
136
|
+
* @type boolean
|
|
137
|
+
* @example
|
|
138
|
+
* <ReqoreButton transparent />
|
|
139
|
+
* <ReqoreButton transparent={true} />
|
|
140
|
+
* <ReqoreButton transparent={false} />
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
transparent?: boolean;
|
|
144
|
+
}
|
|
132
145
|
export interface IWithReqoreEffect {
|
|
133
146
|
/**
|
|
134
147
|
* If true, the component will have an effect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CACnC;AAED,MAAM,WAAW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,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;CAAG;AAC1D,oBAAY,kBAAkB,GAAG,MAAM,GAAG,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -31,7 +31,13 @@ import {
|
|
|
31
31
|
TReqoreTooltipProp,
|
|
32
32
|
} from '../../types/global';
|
|
33
33
|
import { IReqoreIconName } from '../../types/icons';
|
|
34
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
ReqoreTextEffect,
|
|
36
|
+
StyledEffect,
|
|
37
|
+
StyledTextEffect,
|
|
38
|
+
TReqoreEffectColor,
|
|
39
|
+
TReqoreHexColor,
|
|
40
|
+
} from '../Effect';
|
|
35
41
|
import ReqoreIcon from '../Icon';
|
|
36
42
|
import { ReqoreSpacer } from '../Spacer';
|
|
37
43
|
import ReqoreTag, { IReqoreTagProps } from '../Tag';
|
|
@@ -65,9 +71,10 @@ export interface IReqoreButtonProps
|
|
|
65
71
|
export interface IReqoreButtonStyle extends Omit<IReqoreButtonProps, 'intent'> {
|
|
66
72
|
theme: IReqoreTheme;
|
|
67
73
|
animate?: boolean;
|
|
74
|
+
color?: TReqoreHexColor;
|
|
68
75
|
}
|
|
69
76
|
|
|
70
|
-
const getButtonMainColor = (theme: IReqoreTheme, color?:
|
|
77
|
+
const getButtonMainColor = (theme: IReqoreTheme, color?: TReqoreHexColor) => {
|
|
71
78
|
if (color) {
|
|
72
79
|
return color;
|
|
73
80
|
}
|
|
@@ -280,7 +287,7 @@ export const StyledButtonContent = styled.div`
|
|
|
280
287
|
`;
|
|
281
288
|
|
|
282
289
|
export interface IReqoreButtonBadgeProps extends IWithReqoreSize {
|
|
283
|
-
color?:
|
|
290
|
+
color?: TReqoreEffectColor;
|
|
284
291
|
content?: TReqoreBadge | TReqoreBadge[];
|
|
285
292
|
}
|
|
286
293
|
|
|
@@ -291,7 +298,8 @@ export const ButtonBadge = memo((props: IReqoreButtonBadgeProps) => {
|
|
|
291
298
|
key={key}
|
|
292
299
|
size={getOneLessSize(size)}
|
|
293
300
|
badge
|
|
294
|
-
color={color
|
|
301
|
+
color={color}
|
|
302
|
+
minimal={!(content as IReqoreTagProps)?.effect?.gradient}
|
|
295
303
|
{...(typeof content === 'string' || typeof content === 'number'
|
|
296
304
|
? { label: content }
|
|
297
305
|
: content)}
|
|
@@ -358,7 +366,7 @@ const ReqoreButton = memo(
|
|
|
358
366
|
// If color or intent was specified, set the color
|
|
359
367
|
const customColor = intent ? theme.main : changeLightness(theme.main, 0.07);
|
|
360
368
|
const _flat = minimal ? flat : flat !== false;
|
|
361
|
-
const color = customColor
|
|
369
|
+
const color: TReqoreHexColor = customColor
|
|
362
370
|
? minimal
|
|
363
371
|
? getReadableColor(theme, undefined, undefined, true, theme.originalMain)
|
|
364
372
|
: getReadableColorFrom(customColor, true)
|
|
@@ -3,7 +3,6 @@ import { IReqoreComponent } from '../../types/global';
|
|
|
3
3
|
import ReqoreInput from '../Input';
|
|
4
4
|
import ReqoreMenu from '../Menu';
|
|
5
5
|
import ReqoreMenuItem, { IReqoreMenuItemProps } from '../Menu/item';
|
|
6
|
-
import { ReqoreSpacer } from '../Spacer';
|
|
7
6
|
|
|
8
7
|
export type TDropdownItemOnClick = (item: IReqoreDropdownItem) => void;
|
|
9
8
|
export interface IReqoreDropdownItem extends Omit<IReqoreMenuItemProps, 'onClick'> {
|
|
@@ -86,7 +85,6 @@ const ReqoreDropdownList = memo(
|
|
|
86
85
|
placeholder='Filter'
|
|
87
86
|
onClearClick={() => setQuery('')}
|
|
88
87
|
/>
|
|
89
|
-
<ReqoreSpacer height={10} />
|
|
90
88
|
</>
|
|
91
89
|
)}
|
|
92
90
|
{filteredItems.map((item: IReqoreDropdownItem, index: number) => (
|
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
import { reduce } from 'lodash';
|
|
2
|
+
import { mix } from 'polished';
|
|
2
3
|
import { HTMLAttributes } from 'react';
|
|
3
4
|
import styled, { css } from 'styled-components';
|
|
4
5
|
import { TEXT_FROM_SIZE, TSizes, WEIGHT_TO_NUMBER } from '../../constants/sizes';
|
|
5
6
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
6
7
|
import {
|
|
7
|
-
changeDarkness,
|
|
8
8
|
changeLightness,
|
|
9
|
-
|
|
9
|
+
getColorFromMaybeString,
|
|
10
|
+
getReadableColorFrom,
|
|
10
11
|
} from '../../helpers/colors';
|
|
11
12
|
|
|
13
|
+
export type TReqoreEffectColorManipulation = 'darken' | 'lighten';
|
|
14
|
+
export type TReqoreEffectColorManipulationMultiplier = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
15
|
+
export type TReqoreHexColor = `#${string}`;
|
|
16
|
+
export type TReqoreColor = TReqoreHexColor | 'transparent';
|
|
17
|
+
export type TReqoreEffectColor =
|
|
18
|
+
| TReqoreColor
|
|
19
|
+
| TReqoreIntent
|
|
20
|
+
| `${TReqoreIntent}:${TReqoreEffectColorManipulation}`
|
|
21
|
+
| `${TReqoreIntent}:${TReqoreEffectColorManipulation}:${TReqoreEffectColorManipulationMultiplier}`
|
|
22
|
+
| 'main'
|
|
23
|
+
| `main:${TReqoreEffectColorManipulation}`
|
|
24
|
+
| `main:${TReqoreEffectColorManipulation}:${TReqoreEffectColorManipulationMultiplier}`;
|
|
25
|
+
export type TReqoreEffectColorList = [
|
|
26
|
+
'main' | TReqoreIntent | TReqoreColor,
|
|
27
|
+
TReqoreEffectColorManipulation | undefined,
|
|
28
|
+
TReqoreEffectColorManipulationMultiplier | undefined
|
|
29
|
+
];
|
|
30
|
+
|
|
12
31
|
export interface IReqoreEffect {
|
|
13
32
|
gradient?: {
|
|
14
33
|
type?: 'linear' | 'radial';
|
|
15
34
|
shape?: 'circle' | 'ellipse';
|
|
16
|
-
colors:
|
|
35
|
+
colors: Record<number, TReqoreEffectColor>;
|
|
17
36
|
direction?: string;
|
|
18
|
-
borderColor?:
|
|
37
|
+
borderColor?: TReqoreEffectColor;
|
|
19
38
|
};
|
|
20
39
|
noWrap?: boolean;
|
|
21
|
-
color?:
|
|
40
|
+
color?: TReqoreEffectColor;
|
|
22
41
|
spaced?: number;
|
|
23
42
|
weight?: number | 'thin' | 'light' | 'normal' | 'bold' | 'thick';
|
|
24
43
|
uppercase?: boolean;
|
|
@@ -26,7 +45,7 @@ export interface IReqoreEffect {
|
|
|
26
45
|
textAlign?: 'left' | 'center' | 'right';
|
|
27
46
|
glow?: {
|
|
28
47
|
size?: number;
|
|
29
|
-
color:
|
|
48
|
+
color: TReqoreEffectColor;
|
|
30
49
|
inset?: boolean;
|
|
31
50
|
blur?: number;
|
|
32
51
|
useBorder?: boolean;
|
|
@@ -55,13 +74,16 @@ export const StyledEffect = styled.span`
|
|
|
55
74
|
effect.gradient.colors,
|
|
56
75
|
(colorsString, color, percentage) =>
|
|
57
76
|
`${colorsString}, ${
|
|
58
|
-
color === 'transparent' || !effect.interactive
|
|
77
|
+
color === 'transparent' || !effect.interactive
|
|
78
|
+
? getColorFromMaybeString(theme, color)
|
|
79
|
+
: changeLightness(getColorFromMaybeString(theme, color), 0.03)
|
|
59
80
|
} ${percentage}%`,
|
|
60
81
|
''
|
|
61
82
|
);
|
|
62
83
|
const gradientColorsActive = reduce(
|
|
63
84
|
effect.gradient.colors,
|
|
64
|
-
(colorsString, color, percentage) =>
|
|
85
|
+
(colorsString, color, percentage) =>
|
|
86
|
+
`${colorsString}, ${getColorFromMaybeString(theme, color)} ${percentage}%`,
|
|
65
87
|
''
|
|
66
88
|
);
|
|
67
89
|
|
|
@@ -72,20 +94,44 @@ export const StyledEffect = styled.span`
|
|
|
72
94
|
const gradient = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColors})`;
|
|
73
95
|
const gradientActive = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColorsActive})`;
|
|
74
96
|
|
|
75
|
-
|
|
97
|
+
// Determine the text color based on the gradient colors
|
|
98
|
+
let color: TReqoreHexColor | undefined;
|
|
99
|
+
// Only works if there are 2 colors not more and color was not provided
|
|
100
|
+
if (!effect.color) {
|
|
101
|
+
if (Object.keys(effect.gradient.colors).length === 2) {
|
|
102
|
+
const gradientColor1: TReqoreHexColor = getColorFromMaybeString(
|
|
103
|
+
theme,
|
|
104
|
+
Object.values(effect.gradient.colors)[0]
|
|
105
|
+
);
|
|
106
|
+
const gradientColor2: TReqoreHexColor = getColorFromMaybeString(
|
|
107
|
+
theme,
|
|
108
|
+
Object.values(effect.gradient.colors)[1]
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
color = mix(
|
|
112
|
+
0.5,
|
|
113
|
+
gradientColor1 === '#00000000' ? theme.main : gradientColor1,
|
|
114
|
+
gradientColor2 === '#00000000' ? theme.main : gradientColor2
|
|
115
|
+
) as TReqoreHexColor;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
76
118
|
|
|
77
119
|
return css`
|
|
78
120
|
background-image: ${gradient};
|
|
79
121
|
// Get the first color from the colors object
|
|
80
122
|
border-color: ${changeLightness(
|
|
81
|
-
|
|
123
|
+
getColorFromMaybeString(
|
|
82
124
|
theme,
|
|
83
|
-
effect.gradient.borderColor ||
|
|
84
|
-
changeDarkness(Object.values(effect.gradient.colors)[0], 0.05)
|
|
125
|
+
effect.gradient.borderColor || Object.values(effect.gradient.colors)[0]
|
|
85
126
|
),
|
|
86
127
|
0.04
|
|
87
128
|
)} !important;
|
|
88
129
|
|
|
130
|
+
${color &&
|
|
131
|
+
css`
|
|
132
|
+
color: ${getReadableColorFrom(getColorFromMaybeString(theme, color), false)} !important;
|
|
133
|
+
`}
|
|
134
|
+
|
|
89
135
|
${effect.interactive &&
|
|
90
136
|
css`
|
|
91
137
|
cursor: pointer;
|
|
@@ -94,10 +140,9 @@ export const StyledEffect = styled.span`
|
|
|
94
140
|
&:focus,
|
|
95
141
|
&:active {
|
|
96
142
|
background-image: ${gradientActive};
|
|
97
|
-
border-color: ${
|
|
143
|
+
border-color: ${getColorFromMaybeString(
|
|
98
144
|
theme,
|
|
99
|
-
effect.gradient.borderColor ||
|
|
100
|
-
changeDarkness(Object.values(effect.gradient.colors)[0], 0.05)
|
|
145
|
+
effect.gradient.borderColor || Object.values(effect.gradient.colors)[0]
|
|
101
146
|
)} !important;
|
|
102
147
|
}
|
|
103
148
|
`}
|
|
@@ -112,13 +157,13 @@ export const StyledEffect = styled.span`
|
|
|
112
157
|
if (effect.glow.useBorder) {
|
|
113
158
|
return css`
|
|
114
159
|
border: ${effect.glow.size || 2}px solid
|
|
115
|
-
${
|
|
160
|
+
${getColorFromMaybeString(theme, effect.glow.color)} !important;
|
|
116
161
|
`;
|
|
117
162
|
}
|
|
118
163
|
|
|
119
164
|
return css`
|
|
120
165
|
box-shadow: ${effect.glow.inset ? 'inset ' : ''} 0 0 ${effect.glow.blur || 0}
|
|
121
|
-
${effect.glow.size || 2}px ${
|
|
166
|
+
${effect.glow.size || 2}px ${getColorFromMaybeString(theme, effect.glow.color)};
|
|
122
167
|
`;
|
|
123
168
|
}}
|
|
124
169
|
|
|
@@ -158,10 +203,10 @@ export const StyledEffect = styled.span`
|
|
|
158
203
|
`
|
|
159
204
|
: undefined}
|
|
160
205
|
|
|
161
|
-
${({ effect }: IReqoreTextEffectProps) =>
|
|
206
|
+
${({ effect, theme }: IReqoreTextEffectProps) =>
|
|
162
207
|
effect && effect.color
|
|
163
208
|
? css`
|
|
164
|
-
color: ${effect.color} !important;
|
|
209
|
+
color: ${getColorFromMaybeString(theme, effect.color)} !important;
|
|
165
210
|
`
|
|
166
211
|
: undefined}
|
|
167
212
|
|
|
@@ -2,7 +2,6 @@ import { memo, useMemo } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { HEADER_SIZE_TO_NUMBER, TSizes } from '../../constants/sizes';
|
|
4
4
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
5
|
-
import { getReadableColor } from '../../helpers/colors';
|
|
6
5
|
import { isStringSize } from '../../helpers/utils';
|
|
7
6
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
8
7
|
import { IWithReqoreEffect } from '../../types/global';
|
|
@@ -23,8 +22,7 @@ export interface IReqoreHeadingStyle extends IReqoreHeadingProps {
|
|
|
23
22
|
export const StyledHeader = styled(StyledTextEffect)`
|
|
24
23
|
margin: 0;
|
|
25
24
|
padding: 0;
|
|
26
|
-
color: ${({ theme, intent }) =>
|
|
27
|
-
intent ? theme.intents[intent] : getReadableColor(theme, undefined, undefined, true)};
|
|
25
|
+
color: ${({ theme, intent }) => (intent ? theme.intents[intent] : 'inherit')};
|
|
28
26
|
`;
|
|
29
27
|
|
|
30
28
|
export const ReqoreHeading = memo(
|
|
@@ -41,6 +41,7 @@ export interface IReqoreInputProps
|
|
|
41
41
|
flat?: boolean;
|
|
42
42
|
rounded?: boolean;
|
|
43
43
|
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url';
|
|
44
|
+
wrapperStyle?: React.CSSProperties;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
@@ -150,6 +151,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
150
151
|
readOnly,
|
|
151
152
|
customTheme,
|
|
152
153
|
intent,
|
|
154
|
+
wrapperStyle,
|
|
153
155
|
...rest
|
|
154
156
|
}: IReqoreInputProps,
|
|
155
157
|
ref
|
|
@@ -173,6 +175,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
173
175
|
ref={targetRef}
|
|
174
176
|
readOnly={readOnly}
|
|
175
177
|
disabled={rest.disabled}
|
|
178
|
+
style={wrapperStyle}
|
|
176
179
|
>
|
|
177
180
|
{icon && (
|
|
178
181
|
<StyledIconWrapper _size={size}>
|
|
@@ -9,6 +9,7 @@ import PopoverContext from '../../context/PopoverContext';
|
|
|
9
9
|
import { fadeIn } from '../../helpers/animations';
|
|
10
10
|
import { getReadableColor } from '../../helpers/colors';
|
|
11
11
|
import { StyledBackdrop } from '../Drawer';
|
|
12
|
+
import { TReqoreHexColor } from '../Effect';
|
|
12
13
|
|
|
13
14
|
const StyledPopoverArrow = styled.div<{ theme: IReqoreTheme }>`
|
|
14
15
|
width: 10px;
|
|
@@ -37,7 +38,7 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
|
37
38
|
max-height: ${({ maxHeight = '80vh' }) => maxHeight};
|
|
38
39
|
|
|
39
40
|
${({ theme, opaque }) => {
|
|
40
|
-
const defaultColor:
|
|
41
|
+
const defaultColor: TReqoreHexColor = theme.popover?.main || theme.main;
|
|
41
42
|
|
|
42
43
|
if (opaque) {
|
|
43
44
|
return css`
|
|
@@ -15,7 +15,7 @@ export interface IReqoreMenuDividerProps
|
|
|
15
15
|
const StyledMenuDivider = styled(StyledTextEffect)`
|
|
16
16
|
width: 100%;
|
|
17
17
|
padding: ${({ size }) => `${PADDING_FROM_SIZE[size]}px 0`};
|
|
18
|
-
background-color:
|
|
18
|
+
background-color: transparent;
|
|
19
19
|
|
|
20
20
|
color: ${({ theme }) => getReadableColor(theme, undefined, undefined)};
|
|
21
21
|
`;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
+
import { RADIUS_FROM_SIZE } from '../../constants/sizes';
|
|
3
4
|
import { IReqoreCustomTheme, IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
4
5
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
5
|
-
import { changeLightness } from '../../helpers/colors';
|
|
6
|
+
import { changeDarkness, changeLightness, getMainBackgroundColor } from '../../helpers/colors';
|
|
6
7
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
7
|
-
import { IReqoreComponent } from '../../types/global';
|
|
8
|
-
import { StyledReqoreControlGroup } from '../ControlGroup';
|
|
8
|
+
import { IReqoreComponent, IWithReqoreMinimal, IWithReqoreTransparent } from '../../types/global';
|
|
9
9
|
|
|
10
|
-
export interface IReqoreMenuProps
|
|
10
|
+
export interface IReqoreMenuProps
|
|
11
|
+
extends IReqoreComponent,
|
|
12
|
+
IWithReqoreMinimal,
|
|
13
|
+
IWithReqoreTransparent,
|
|
14
|
+
React.HTMLAttributes<HTMLDivElement> {
|
|
11
15
|
children: any;
|
|
12
16
|
position?: 'left' | 'right';
|
|
13
17
|
width?: string;
|
|
@@ -16,6 +20,7 @@ export interface IReqoreMenuProps extends IReqoreComponent, React.HTMLAttributes
|
|
|
16
20
|
intent?: TReqoreIntent;
|
|
17
21
|
wrapText?: boolean;
|
|
18
22
|
flat?: boolean;
|
|
23
|
+
rounded?: boolean;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
export interface IReqoreMenuStyle extends IReqoreMenuProps {
|
|
@@ -30,7 +35,9 @@ const StyledReqoreMenu = styled.div<IReqoreMenuStyle>`
|
|
|
30
35
|
overflow-y: auto;
|
|
31
36
|
overflow-x: hidden;
|
|
32
37
|
|
|
33
|
-
background-color: ${({ theme }) =>
|
|
38
|
+
background-color: ${({ theme, transparent }) =>
|
|
39
|
+
transparent ? 'transparent' : changeDarkness(getMainBackgroundColor(theme), 0.03)};
|
|
40
|
+
border-radius: ${({ rounded }) => (rounded ? `${RADIUS_FROM_SIZE['normal']}px` : `0`)};
|
|
34
41
|
|
|
35
42
|
${({ theme, position }) =>
|
|
36
43
|
position &&
|
|
@@ -42,7 +49,7 @@ const StyledReqoreMenu = styled.div<IReqoreMenuStyle>`
|
|
|
42
49
|
padding-${position === 'left' ? 'right' : 'left'}: 10px;
|
|
43
50
|
`}
|
|
44
51
|
|
|
45
|
-
|
|
52
|
+
> *:not(:last-child) {
|
|
46
53
|
margin-bottom: 5px;
|
|
47
54
|
}
|
|
48
55
|
`;
|
|
@@ -58,6 +65,7 @@ const ReqoreMenu = forwardRef<HTMLDivElement, IReqoreMenuProps>(
|
|
|
58
65
|
intent,
|
|
59
66
|
wrapText,
|
|
60
67
|
flat = true,
|
|
68
|
+
minimal,
|
|
61
69
|
...rest
|
|
62
70
|
}: IReqoreMenuProps,
|
|
63
71
|
ref: any
|
|
@@ -75,7 +83,8 @@ const ReqoreMenu = forwardRef<HTMLDivElement, IReqoreMenuProps>(
|
|
|
75
83
|
_popoverId,
|
|
76
84
|
customTheme: child?.props.customTheme || theme,
|
|
77
85
|
wrap: wrapText,
|
|
78
|
-
flat: child?.props.flat
|
|
86
|
+
flat: 'flat' in child?.props ? child.props.flat : flat,
|
|
87
|
+
minimal: 'minimal' in child?.props ? child.props.minimal : minimal,
|
|
79
88
|
})
|
|
80
89
|
: null;
|
|
81
90
|
})}
|
|
@@ -3,6 +3,7 @@ import React, { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
|
3
3
|
import { useMount, useUnmount } from 'react-use';
|
|
4
4
|
import { IReqoreTheme } from '../../constants/theme';
|
|
5
5
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
6
|
+
import { getColorFromMaybeString } from '../../helpers/colors';
|
|
6
7
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
7
8
|
import {
|
|
8
9
|
IReqoreIntent,
|
|
@@ -132,7 +133,9 @@ const ReqoreMessage = forwardRef<HTMLDivElement, IReqoreMessageProps>(
|
|
|
132
133
|
<ReqoreHeading
|
|
133
134
|
size={size}
|
|
134
135
|
customTheme={
|
|
135
|
-
rest.effect?.color
|
|
136
|
+
rest.effect?.color
|
|
137
|
+
? { text: { color: getColorFromMaybeString(theme, rest.effect.color) } }
|
|
138
|
+
: undefined
|
|
136
139
|
}
|
|
137
140
|
>
|
|
138
141
|
{title}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { size } from 'lodash';
|
|
2
2
|
import { darken, rgba } from 'polished';
|
|
3
|
-
import {
|
|
3
|
+
import { forwardRef, ReactElement, useCallback, useMemo, useState } from 'react';
|
|
4
4
|
import { useUpdateEffect } from 'react-use';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import {
|
|
@@ -13,6 +13,7 @@ import { ReqorePopover } from '../..';
|
|
|
13
13
|
import { SIZE_TO_PX, TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
14
14
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
15
15
|
import { changeLightness, getReadableColorFrom } from '../../helpers/colors';
|
|
16
|
+
import { TReqoreColor, TReqoreHexColor } from '../Effect';
|
|
16
17
|
import { ReqoreH4 } from '../Header';
|
|
17
18
|
import ReqoreIcon from '../Icon';
|
|
18
19
|
import { ReqoreP } from '../Paragraph';
|
|
@@ -102,7 +103,7 @@ export const StyledTableCell = styled.div<IReqoreTableCellStyle>`
|
|
|
102
103
|
disabled,
|
|
103
104
|
hovered,
|
|
104
105
|
}: IReqoreTableCellStyle) => {
|
|
105
|
-
const getBackgroundColor = () => {
|
|
106
|
+
const getBackgroundColor = (): TReqoreColor => {
|
|
106
107
|
let color = theme.main;
|
|
107
108
|
let opacity = 0;
|
|
108
109
|
// Is there any intent
|
|
@@ -147,11 +148,11 @@ export const StyledTableCell = styled.div<IReqoreTableCellStyle>`
|
|
|
147
148
|
? 'transparent'
|
|
148
149
|
: rgba(getBackgroundColor(), 0.8)};
|
|
149
150
|
color: ${getReadableColorFrom(
|
|
150
|
-
backgroundColor === 'transparent' ? theme.main :
|
|
151
|
+
backgroundColor === 'transparent' ? theme.main : backgroundColor,
|
|
151
152
|
!hovered
|
|
152
153
|
)};
|
|
153
154
|
border-color: ${changeLightness(
|
|
154
|
-
backgroundColor === 'transparent' ? theme.main :
|
|
155
|
+
backgroundColor === 'transparent' ? theme.main : backgroundColor,
|
|
155
156
|
0.1
|
|
156
157
|
)};
|
|
157
158
|
transition: background-color 0.2s ease-out;
|
|
@@ -214,8 +215,10 @@ const ReqoreTableRow = ({
|
|
|
214
215
|
let intent: TReqoreIntent = intentOrColor?.startsWith('#')
|
|
215
216
|
? undefined
|
|
216
217
|
: (intentOrColor as TReqoreIntent);
|
|
217
|
-
let color:
|
|
218
|
-
intentOrColor?.startsWith('#') && type === 'tag'
|
|
218
|
+
let color: TReqoreHexColor =
|
|
219
|
+
intentOrColor?.startsWith('#') && type === 'tag'
|
|
220
|
+
? (intentOrColor as TReqoreHexColor)
|
|
221
|
+
: undefined;
|
|
219
222
|
// Render content based on the type
|
|
220
223
|
switch (type) {
|
|
221
224
|
case 'time-ago':
|