@qoretechnologies/reqore 0.28.0 → 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 +14 -10
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/item.js +1 -1
- package/dist/components/Collection/item.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 -19
- 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/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +1 -1
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +1 -1
- package/dist/components/Panel/index.js.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/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +5 -3
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/index.d.ts +6 -3
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +58 -27
- 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 +37 -13
- package/src/components/Collection/item.tsx +1 -1
- package/src/components/Dropdown/list.tsx +0 -2
- package/src/components/Effect/index.tsx +67 -18
- 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/Notifications/notification.tsx +3 -0
- package/src/components/Panel/index.tsx +3 -3
- package/src/components/Table/row.tsx +8 -5
- package/src/components/Tabs/list.tsx +5 -3
- package/src/components/Tag/index.tsx +136 -47
- 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/mock/collectionData.tsx +1 -1
- 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/stories/Panel/Panel.stories.tsx +1 -0
- package/src/stories/Tag/Tag.stories.tsx +43 -0
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
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,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,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"}
|
|
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,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
|
}
|
|
@@ -173,8 +180,8 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
173
180
|
|
|
174
181
|
${InactiveIconScale}
|
|
175
182
|
|
|
176
|
-
${({ readOnly, animate }) =>
|
|
177
|
-
!readOnly
|
|
183
|
+
${({ readOnly, animate, active }) =>
|
|
184
|
+
!readOnly && !active
|
|
178
185
|
? css`
|
|
179
186
|
&:not(:disabled) {
|
|
180
187
|
${ScaleIconOnHover}
|
|
@@ -187,11 +194,16 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
187
194
|
}
|
|
188
195
|
|
|
189
196
|
&:hover,
|
|
197
|
+
&:active,
|
|
190
198
|
&:focus {
|
|
191
|
-
background-color: ${({ theme, color }: IReqoreButtonStyle) =>
|
|
192
|
-
changeLightness(getButtonMainColor(theme, color), 0.05)};
|
|
193
|
-
color: ${({ theme, color }) =>
|
|
194
|
-
getReadableColor(
|
|
199
|
+
background-color: ${({ theme, color, minimal }: IReqoreButtonStyle) =>
|
|
200
|
+
minimal ? `#00000030` : changeLightness(getButtonMainColor(theme, color), 0.05)};
|
|
201
|
+
color: ${({ theme, color, minimal }) =>
|
|
202
|
+
getReadableColor(
|
|
203
|
+
{ main: minimal ? '#00000030' : getButtonMainColor(theme, color) },
|
|
204
|
+
undefined,
|
|
205
|
+
undefined
|
|
206
|
+
)};
|
|
195
207
|
border-color: ${({ flat, theme, color }) =>
|
|
196
208
|
flat ? undefined : changeLightness(getButtonMainColor(theme, color), 0.1)};
|
|
197
209
|
|
|
@@ -212,17 +224,28 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
212
224
|
}
|
|
213
225
|
}
|
|
214
226
|
`
|
|
215
|
-
:
|
|
227
|
+
: readOnly
|
|
228
|
+
? css`
|
|
216
229
|
${ReadOnlyElement};
|
|
217
|
-
`
|
|
230
|
+
`
|
|
231
|
+
: undefined}
|
|
218
232
|
|
|
219
233
|
${({ active, flat, theme, color }: IReqoreButtonStyle) =>
|
|
220
234
|
active &&
|
|
221
235
|
css`
|
|
236
|
+
cursor: pointer;
|
|
222
237
|
background-color: ${changeLightness(getButtonMainColor(theme, color), 0.1)};
|
|
223
238
|
color: ${getReadableColor({ main: getButtonMainColor(theme, color) }, undefined, undefined)};
|
|
224
239
|
border-color: ${flat ? undefined : changeLightness(getButtonMainColor(theme, color), 0.175)};
|
|
225
240
|
|
|
241
|
+
&:hover,
|
|
242
|
+
&:active,
|
|
243
|
+
&:focus {
|
|
244
|
+
border-color: ${flat
|
|
245
|
+
? undefined
|
|
246
|
+
: changeLightness(getButtonMainColor(theme, color), 0.275)};
|
|
247
|
+
}
|
|
248
|
+
|
|
226
249
|
${ActiveIconScale}
|
|
227
250
|
`}
|
|
228
251
|
|
|
@@ -264,7 +287,7 @@ export const StyledButtonContent = styled.div`
|
|
|
264
287
|
`;
|
|
265
288
|
|
|
266
289
|
export interface IReqoreButtonBadgeProps extends IWithReqoreSize {
|
|
267
|
-
color?:
|
|
290
|
+
color?: TReqoreEffectColor;
|
|
268
291
|
content?: TReqoreBadge | TReqoreBadge[];
|
|
269
292
|
}
|
|
270
293
|
|
|
@@ -275,7 +298,8 @@ export const ButtonBadge = memo((props: IReqoreButtonBadgeProps) => {
|
|
|
275
298
|
key={key}
|
|
276
299
|
size={getOneLessSize(size)}
|
|
277
300
|
badge
|
|
278
|
-
color={color
|
|
301
|
+
color={color}
|
|
302
|
+
minimal={!(content as IReqoreTagProps)?.effect?.gradient}
|
|
279
303
|
{...(typeof content === 'string' || typeof content === 'number'
|
|
280
304
|
? { label: content }
|
|
281
305
|
: content)}
|
|
@@ -342,7 +366,7 @@ const ReqoreButton = memo(
|
|
|
342
366
|
// If color or intent was specified, set the color
|
|
343
367
|
const customColor = intent ? theme.main : changeLightness(theme.main, 0.07);
|
|
344
368
|
const _flat = minimal ? flat : flat !== false;
|
|
345
|
-
const color = customColor
|
|
369
|
+
const color: TReqoreHexColor = customColor
|
|
346
370
|
? minimal
|
|
347
371
|
? getReadableColor(theme, undefined, undefined, true, theme.originalMain)
|
|
348
372
|
: getReadableColorFrom(customColor, true)
|
|
@@ -182,7 +182,7 @@ export const ReqoreCollectionItem = ({
|
|
|
182
182
|
{ icon: 'CloseLine', onClick: handleItemClick },
|
|
183
183
|
] as IReqorePanelAction[])
|
|
184
184
|
: size(actions)
|
|
185
|
-
? [{ icon: 'More2Fill', actions }]
|
|
185
|
+
? [{ icon: 'More2Fill', actions, minimal: true, flat: true }]
|
|
186
186
|
: undefined;
|
|
187
187
|
|
|
188
188
|
return (
|
|
@@ -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,28 +94,55 @@ export const StyledEffect = styled.span`
|
|
|
72
94
|
const gradient = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColors})`;
|
|
73
95
|
const gradientActive = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColorsActive})`;
|
|
74
96
|
|
|
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
|
+
}
|
|
118
|
+
|
|
75
119
|
return css`
|
|
76
120
|
background-image: ${gradient};
|
|
77
121
|
// Get the first color from the colors object
|
|
78
122
|
border-color: ${changeLightness(
|
|
79
|
-
|
|
123
|
+
getColorFromMaybeString(
|
|
80
124
|
theme,
|
|
81
|
-
effect.gradient.borderColor ||
|
|
82
|
-
changeDarkness(Object.values(effect.gradient.colors)[0], 0.05)
|
|
125
|
+
effect.gradient.borderColor || Object.values(effect.gradient.colors)[0]
|
|
83
126
|
),
|
|
84
127
|
0.04
|
|
85
128
|
)} !important;
|
|
86
129
|
|
|
130
|
+
${color &&
|
|
131
|
+
css`
|
|
132
|
+
color: ${getReadableColorFrom(getColorFromMaybeString(theme, color), false)} !important;
|
|
133
|
+
`}
|
|
134
|
+
|
|
87
135
|
${effect.interactive &&
|
|
88
136
|
css`
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
|
|
89
139
|
&:hover,
|
|
90
140
|
&:focus,
|
|
91
141
|
&:active {
|
|
92
142
|
background-image: ${gradientActive};
|
|
93
|
-
border-color: ${
|
|
143
|
+
border-color: ${getColorFromMaybeString(
|
|
94
144
|
theme,
|
|
95
|
-
effect.gradient.borderColor ||
|
|
96
|
-
changeDarkness(Object.values(effect.gradient.colors)[0], 0.05)
|
|
145
|
+
effect.gradient.borderColor || Object.values(effect.gradient.colors)[0]
|
|
97
146
|
)} !important;
|
|
98
147
|
}
|
|
99
148
|
`}
|
|
@@ -108,13 +157,13 @@ export const StyledEffect = styled.span`
|
|
|
108
157
|
if (effect.glow.useBorder) {
|
|
109
158
|
return css`
|
|
110
159
|
border: ${effect.glow.size || 2}px solid
|
|
111
|
-
${
|
|
160
|
+
${getColorFromMaybeString(theme, effect.glow.color)} !important;
|
|
112
161
|
`;
|
|
113
162
|
}
|
|
114
163
|
|
|
115
164
|
return css`
|
|
116
165
|
box-shadow: ${effect.glow.inset ? 'inset ' : ''} 0 0 ${effect.glow.blur || 0}
|
|
117
|
-
${effect.glow.size || 2}px ${
|
|
166
|
+
${effect.glow.size || 2}px ${getColorFromMaybeString(theme, effect.glow.color)};
|
|
118
167
|
`;
|
|
119
168
|
}}
|
|
120
169
|
|
|
@@ -154,10 +203,10 @@ export const StyledEffect = styled.span`
|
|
|
154
203
|
`
|
|
155
204
|
: undefined}
|
|
156
205
|
|
|
157
|
-
${({ effect }: IReqoreTextEffectProps) =>
|
|
206
|
+
${({ effect, theme }: IReqoreTextEffectProps) =>
|
|
158
207
|
effect && effect.color
|
|
159
208
|
? css`
|
|
160
|
-
color: ${effect.color} !important;
|
|
209
|
+
color: ${getColorFromMaybeString(theme, effect.color)} !important;
|
|
161
210
|
`
|
|
162
211
|
: undefined}
|
|
163
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 {
|
|
@@ -459,7 +459,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
459
459
|
) : (
|
|
460
460
|
label
|
|
461
461
|
)}
|
|
462
|
-
{badge
|
|
462
|
+
{badge || badge === 0 ? (
|
|
463
463
|
<>
|
|
464
464
|
<ButtonBadge
|
|
465
465
|
color={changeLightness(theme.main, 0.18)}
|
|
@@ -468,7 +468,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
468
468
|
/>
|
|
469
469
|
<ReqoreSpacer width={PADDING_FROM_SIZE.normal} />
|
|
470
470
|
</>
|
|
471
|
-
)}
|
|
471
|
+
) : null}
|
|
472
472
|
</StyledPanelTitleHeader>
|
|
473
473
|
<ReqoreControlGroup>
|
|
474
474
|
{actions.map(renderActions)}
|
|
@@ -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':
|
|
@@ -203,9 +203,11 @@ const ReqoreTabsList = ({
|
|
|
203
203
|
label: getMoreLabel(item, activeTab),
|
|
204
204
|
active: !!isTabHidden(item, activeTab),
|
|
205
205
|
activeIntent: activeTabIntent,
|
|
206
|
-
customTheme:
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
customTheme: !!isTabHidden(item, activeTab)
|
|
207
|
+
? {
|
|
208
|
+
main: currentTabColor,
|
|
209
|
+
}
|
|
210
|
+
: theme,
|
|
209
211
|
vertical,
|
|
210
212
|
flat,
|
|
211
213
|
size,
|