@qoretechnologies/reqore 0.28.1 → 0.28.3
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__/dropdown.test.tsx +1 -1
- package/__tests__/effect.test.tsx +6 -6
- package/dist/components/Button/index.d.ts +4 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +23 -15
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +2 -2
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +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 +6 -3
- 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/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +1 -1
- package/dist/components/Menu/item.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 +34 -11
- package/src/components/ControlGroup/index.tsx +2 -0
- package/src/components/Dropdown/list.tsx +2 -3
- package/src/components/Effect/index.tsx +64 -19
- package/src/components/Header/index.tsx +1 -3
- package/src/components/Input/index.tsx +11 -2
- 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/Menu/item.tsx +3 -2
- 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/ControlGroup/ControlGroup.stories.tsx +9 -1
- package/src/stories/Dropdown/Dropdown.stories.tsx +26 -0
- package/src/stories/Menu/Menu.stories.tsx +52 -3
- package/src/stories/Message/Message.stories.tsx +3 -4
- package/src/stories/Tag/Tag.stories.tsx +25 -1
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
package/src/constants/theme.ts
CHANGED
|
@@ -1,64 +1,66 @@
|
|
|
1
|
+
import { TReqoreEffectColor, TReqoreHexColor } from '../components/Effect';
|
|
2
|
+
|
|
1
3
|
export interface IReqoreSidebarTheme {
|
|
2
|
-
main?:
|
|
3
|
-
color?:
|
|
4
|
-
border?:
|
|
4
|
+
main?: TReqoreHexColor;
|
|
5
|
+
color?: TReqoreHexColor;
|
|
6
|
+
border?: TReqoreHexColor;
|
|
5
7
|
item?: {
|
|
6
|
-
color?:
|
|
7
|
-
background?:
|
|
8
|
-
border?:
|
|
9
|
-
hoverColor?:
|
|
10
|
-
hoverBackground?:
|
|
11
|
-
activeColor?:
|
|
12
|
-
activeBackground?:
|
|
8
|
+
color?: TReqoreHexColor;
|
|
9
|
+
background?: TReqoreHexColor;
|
|
10
|
+
border?: TReqoreHexColor;
|
|
11
|
+
hoverColor?: TReqoreHexColor;
|
|
12
|
+
hoverBackground?: TReqoreHexColor;
|
|
13
|
+
activeColor?: TReqoreHexColor;
|
|
14
|
+
activeBackground?: TReqoreHexColor;
|
|
13
15
|
};
|
|
14
16
|
subItem?: {
|
|
15
|
-
color?:
|
|
16
|
-
border?:
|
|
17
|
-
background?:
|
|
18
|
-
hoverColor?:
|
|
19
|
-
hoverBackground?:
|
|
20
|
-
activeColor?:
|
|
21
|
-
activeBackground?:
|
|
17
|
+
color?: TReqoreHexColor;
|
|
18
|
+
border?: TReqoreHexColor;
|
|
19
|
+
background?: TReqoreHexColor;
|
|
20
|
+
hoverColor?: TReqoreHexColor;
|
|
21
|
+
hoverBackground?: TReqoreHexColor;
|
|
22
|
+
activeColor?: TReqoreHexColor;
|
|
23
|
+
activeBackground?: TReqoreHexColor;
|
|
22
24
|
};
|
|
23
25
|
icon?: {
|
|
24
|
-
color?:
|
|
25
|
-
hoverColor?:
|
|
26
|
-
activeColor?:
|
|
26
|
+
color?: TReqoreHexColor;
|
|
27
|
+
hoverColor?: TReqoreHexColor;
|
|
28
|
+
activeColor?: TReqoreHexColor;
|
|
27
29
|
};
|
|
28
30
|
section?: {
|
|
29
|
-
background?:
|
|
31
|
+
background?: TReqoreHexColor;
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export interface IReqoreBreadcrumbsTheme {
|
|
34
|
-
main?:
|
|
36
|
+
main?: TReqoreHexColor;
|
|
35
37
|
item?: {
|
|
36
|
-
color?:
|
|
37
|
-
hoverColor?:
|
|
38
|
-
activeColor?:
|
|
38
|
+
color?: TReqoreHexColor;
|
|
39
|
+
hoverColor?: TReqoreHexColor;
|
|
40
|
+
activeColor?: TReqoreHexColor;
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export interface IReqoreNavbarTheme {
|
|
43
|
-
main?:
|
|
44
|
-
color?:
|
|
45
|
-
border?:
|
|
46
|
-
background?:
|
|
47
|
-
hoverColor?:
|
|
45
|
+
main?: TReqoreHexColor;
|
|
46
|
+
color?: TReqoreHexColor;
|
|
47
|
+
border?: TReqoreHexColor;
|
|
48
|
+
background?: TReqoreHexColor;
|
|
49
|
+
hoverColor?: TReqoreHexColor;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
export interface IReqoreTheme {
|
|
51
|
-
main:
|
|
52
|
-
originalMain?:
|
|
53
|
+
main: TReqoreHexColor;
|
|
54
|
+
originalMain?: TReqoreHexColor;
|
|
53
55
|
text?: {
|
|
54
|
-
color?:
|
|
56
|
+
color?: TReqoreHexColor;
|
|
55
57
|
dim?: boolean;
|
|
56
58
|
};
|
|
57
59
|
intents: IReqoreIntents;
|
|
58
60
|
sidebar?: IReqoreSidebarTheme;
|
|
59
61
|
notifications: IReqoreIntents;
|
|
60
62
|
popover?: {
|
|
61
|
-
main:
|
|
63
|
+
main: TReqoreHexColor;
|
|
62
64
|
};
|
|
63
65
|
header?: IReqoreNavbarTheme;
|
|
64
66
|
footer?: IReqoreNavbarTheme;
|
|
@@ -66,20 +68,20 @@ export interface IReqoreTheme {
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
export interface IReqoreCustomTheme {
|
|
69
|
-
main?:
|
|
71
|
+
main?: TReqoreEffectColor;
|
|
70
72
|
text?: {
|
|
71
|
-
color?:
|
|
73
|
+
color?: TReqoreEffectColor;
|
|
72
74
|
dim?: boolean;
|
|
73
75
|
};
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
export interface IReqoreIntents {
|
|
77
|
-
info?:
|
|
78
|
-
success?:
|
|
79
|
-
pending?:
|
|
80
|
-
warning?:
|
|
81
|
-
danger?:
|
|
82
|
-
muted?:
|
|
79
|
+
info?: TReqoreHexColor;
|
|
80
|
+
success?: TReqoreHexColor;
|
|
81
|
+
pending?: TReqoreHexColor;
|
|
82
|
+
warning?: TReqoreHexColor;
|
|
83
|
+
danger?: TReqoreHexColor;
|
|
84
|
+
muted?: TReqoreHexColor;
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
export type TReqoreIntent = 'info' | 'success' | 'pending' | 'warning' | 'danger' | 'muted';
|
package/src/helpers/colors.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { cloneDeep, merge } from 'lodash';
|
|
2
2
|
import { darken, lighten, readableColor } from 'polished';
|
|
3
|
+
import { TReqoreEffectColor, TReqoreEffectColorList, TReqoreHexColor } from '../components/Effect';
|
|
3
4
|
import { Colors } from '../constants/colors';
|
|
4
5
|
import { DEFAULT_INTENTS, IReqoreTheme, TReqoreIntent } from '../constants/theme';
|
|
5
6
|
|
|
6
7
|
export const getReadableColor: (
|
|
7
8
|
theme: Partial<IReqoreTheme>,
|
|
8
|
-
ifLight?:
|
|
9
|
-
ifDark?:
|
|
9
|
+
ifLight?: TReqoreHexColor,
|
|
10
|
+
ifDark?: TReqoreHexColor,
|
|
10
11
|
dimmed?: boolean,
|
|
11
|
-
fallback?:
|
|
12
|
-
) =>
|
|
12
|
+
fallback?: TReqoreHexColor
|
|
13
|
+
) => TReqoreHexColor = (theme, ifLight, ifDark, dimmed, fallback) => {
|
|
13
14
|
if (theme.text?.color) {
|
|
14
15
|
return theme.text.dim
|
|
15
16
|
? dimmed
|
|
@@ -25,15 +26,15 @@ export const getReadableColor: (
|
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
export const getReadableColorFrom = (
|
|
28
|
-
from:
|
|
29
|
+
from: TReqoreHexColor,
|
|
29
30
|
dim?: boolean,
|
|
30
|
-
ifLight?:
|
|
31
|
-
ifDark?:
|
|
32
|
-
) => {
|
|
31
|
+
ifLight?: TReqoreHexColor,
|
|
32
|
+
ifDark?: TReqoreHexColor
|
|
33
|
+
): TReqoreHexColor => {
|
|
33
34
|
const returnIfLight = ifLight || lighten(dim ? 0.05 : 0, Colors.DARK);
|
|
34
35
|
const returnIfDark = ifDark || darken(dim ? 0.05 : 0, Colors.LIGHT);
|
|
35
36
|
|
|
36
|
-
return readableColor(from, returnIfLight, returnIfDark, false);
|
|
37
|
+
return readableColor(from, returnIfLight, returnIfDark, false) as TReqoreHexColor;
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
export const percentToHexAlpha = (p: number) => {
|
|
@@ -44,29 +45,33 @@ export const percentToHexAlpha = (p: number) => {
|
|
|
44
45
|
return hexValue.padStart(2, '0').toUpperCase(); // format with leading 0 and upper case characters
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
export const shouldDarken = (mainColor:
|
|
48
|
+
export const shouldDarken = (mainColor: TReqoreHexColor): boolean => {
|
|
48
49
|
const contrast = getColorByBgColor(mainColor);
|
|
49
50
|
|
|
50
51
|
return contrast === '#000000';
|
|
51
52
|
};
|
|
52
53
|
|
|
53
|
-
export const getMainColor: (theme: IReqoreTheme, component: string) =>
|
|
54
|
+
export const getMainColor: (theme: IReqoreTheme, component: string) => TReqoreHexColor = (
|
|
54
55
|
theme,
|
|
55
56
|
component
|
|
56
57
|
) => theme[component]?.main || theme.main;
|
|
57
58
|
|
|
58
59
|
//export const changeBasedOnContrast = (color: string, lightness?: number): string =>
|
|
59
60
|
|
|
60
|
-
export const changeLightness = (color:
|
|
61
|
+
export const changeLightness = (color: TReqoreHexColor, lightness?: number): TReqoreHexColor => {
|
|
61
62
|
return lightness
|
|
62
63
|
? shouldDarken(color)
|
|
63
|
-
? darken(lightness, color)
|
|
64
|
-
: lighten(lightness, color)
|
|
64
|
+
? (darken(lightness, color) as TReqoreHexColor)
|
|
65
|
+
: (lighten(lightness, color) as TReqoreHexColor)
|
|
65
66
|
: color;
|
|
66
67
|
};
|
|
67
68
|
|
|
68
|
-
export const changeDarkness = (color:
|
|
69
|
-
lightness
|
|
69
|
+
export const changeDarkness = (color: TReqoreHexColor, lightness?: number): TReqoreHexColor =>
|
|
70
|
+
lightness
|
|
71
|
+
? shouldDarken(color)
|
|
72
|
+
? (lighten(lightness, color) as TReqoreHexColor)
|
|
73
|
+
: (darken(lightness, color) as TReqoreHexColor)
|
|
74
|
+
: color;
|
|
70
75
|
|
|
71
76
|
export const getColorByBgColor = (bgColor) => {
|
|
72
77
|
if (!bgColor) {
|
|
@@ -76,7 +81,7 @@ export const getColorByBgColor = (bgColor) => {
|
|
|
76
81
|
};
|
|
77
82
|
|
|
78
83
|
export const isValidSixCharHex = (hex: string): boolean => {
|
|
79
|
-
return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(hex);
|
|
84
|
+
return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$/.test(hex);
|
|
80
85
|
};
|
|
81
86
|
|
|
82
87
|
export const buildTheme = (theme: IReqoreTheme): IReqoreTheme => {
|
|
@@ -142,20 +147,47 @@ export const getNotificationIntent = (theme: IReqoreTheme, intent?: TReqoreInten
|
|
|
142
147
|
return changeLightness(theme.main, 0.1);
|
|
143
148
|
};
|
|
144
149
|
|
|
145
|
-
export const getMainBackgroundColor = (theme: IReqoreTheme):
|
|
150
|
+
export const getMainBackgroundColor = (theme: IReqoreTheme): TReqoreHexColor =>
|
|
146
151
|
changeLightness(theme.main, 0.02);
|
|
147
152
|
|
|
148
|
-
export const
|
|
153
|
+
export const getColorFromMaybeString = (
|
|
149
154
|
theme: IReqoreTheme,
|
|
150
|
-
|
|
151
|
-
):
|
|
152
|
-
if (
|
|
153
|
-
return
|
|
155
|
+
color: TReqoreEffectColor
|
|
156
|
+
): TReqoreHexColor => {
|
|
157
|
+
if (!color) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const [providedColor, shading, multiplier = 1]: TReqoreEffectColorList = color.split(
|
|
162
|
+
':'
|
|
163
|
+
) as TReqoreEffectColorList;
|
|
164
|
+
|
|
165
|
+
if (providedColor === 'transparent') {
|
|
166
|
+
return '#00000000';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// First we need to get the actual color
|
|
170
|
+
let _color: TReqoreHexColor;
|
|
171
|
+
|
|
172
|
+
if (!providedColor || providedColor === 'main') {
|
|
173
|
+
_color = theme.main;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (theme.intents[providedColor]) {
|
|
177
|
+
_color = theme.intents[providedColor];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (isValidSixCharHex(color)) {
|
|
181
|
+
_color = providedColor as TReqoreHexColor;
|
|
154
182
|
}
|
|
155
183
|
|
|
156
|
-
if (
|
|
157
|
-
|
|
184
|
+
if (shading) {
|
|
185
|
+
if (shading === 'lighten') {
|
|
186
|
+
_color = lighten(0.1 * multiplier, _color) as TReqoreHexColor;
|
|
187
|
+
} else if (shading === 'darken') {
|
|
188
|
+
_color = darken(0.1 * multiplier, _color) as TReqoreHexColor;
|
|
189
|
+
}
|
|
158
190
|
}
|
|
159
191
|
|
|
160
|
-
return
|
|
192
|
+
return _color;
|
|
161
193
|
};
|
package/src/hooks/useTheme.ts
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import { cloneDeep } from 'lodash';
|
|
2
2
|
import { useContext } from 'react';
|
|
3
|
+
import { TReqoreEffectColor } from '../components/Effect';
|
|
3
4
|
import { IReqoreTheme, TReqoreIntent } from '../constants/theme';
|
|
4
5
|
import ThemeContext from '../context/ThemeContext';
|
|
5
|
-
import { mergeThemes } from '../helpers/colors';
|
|
6
|
+
import { getColorFromMaybeString, mergeThemes } from '../helpers/colors';
|
|
7
|
+
|
|
8
|
+
export interface IReqoreCustomTheme extends Partial<Omit<IReqoreTheme, 'main' | 'text'>> {
|
|
9
|
+
main?: TReqoreEffectColor;
|
|
10
|
+
text?: {
|
|
11
|
+
color?: TReqoreEffectColor;
|
|
12
|
+
dim?: boolean;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
6
15
|
|
|
7
16
|
export const useReqoreTheme = (
|
|
8
17
|
element: string,
|
|
9
|
-
customTheme:
|
|
18
|
+
customTheme: IReqoreCustomTheme = {},
|
|
10
19
|
intent?: TReqoreIntent
|
|
11
20
|
) => {
|
|
12
21
|
const theme: IReqoreTheme = useContext<IReqoreTheme>(ThemeContext);
|
|
13
|
-
let _customTheme:
|
|
22
|
+
let _customTheme: IReqoreCustomTheme = cloneDeep(customTheme);
|
|
23
|
+
|
|
24
|
+
if (_customTheme.main) {
|
|
25
|
+
_customTheme.main = getColorFromMaybeString(theme, customTheme.main);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (_customTheme.text?.color) {
|
|
29
|
+
_customTheme.text.color = getColorFromMaybeString(theme, customTheme.text.color);
|
|
30
|
+
}
|
|
14
31
|
|
|
15
32
|
if (element === 'main' && intent) {
|
|
16
33
|
_customTheme.main = theme.intents[intent];
|
|
@@ -110,7 +110,7 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
110
110
|
{
|
|
111
111
|
effect: {
|
|
112
112
|
gradient: {
|
|
113
|
-
colors: { 0: '
|
|
113
|
+
colors: { 0: 'danger', 100: 'danger:darken' },
|
|
114
114
|
direction: 'to right bottom',
|
|
115
115
|
},
|
|
116
116
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
2
|
import { IReqoreControlGroupProps } from '../../components/ControlGroup';
|
|
3
3
|
import ReqoreInput from '../../components/Input';
|
|
4
|
-
import { ReqoreButton, ReqoreControlGroup } from '../../index';
|
|
4
|
+
import { ReqoreButton, ReqoreControlGroup, ReqoreTag } from '../../index';
|
|
5
5
|
import { MinimalArg, SizeArg, argManager } from '../utils/args';
|
|
6
6
|
|
|
7
7
|
const { createArg } = argManager<IReqoreControlGroupProps>();
|
|
@@ -36,6 +36,14 @@ const Template: Story<IReqoreControlGroupProps> = (args: IReqoreControlGroupProp
|
|
|
36
36
|
return (
|
|
37
37
|
<ReqoreControlGroup {...args}>
|
|
38
38
|
<ReqoreButton>Button</ReqoreButton>
|
|
39
|
+
<ReqoreButton
|
|
40
|
+
flat={false}
|
|
41
|
+
effect={{ gradient: { colors: { 0: 'success', 100: 'success:darken:1' } } }}
|
|
42
|
+
>
|
|
43
|
+
Non flat Button
|
|
44
|
+
</ReqoreButton>
|
|
45
|
+
<ReqoreButton maxWidth='300px'>Button with max width</ReqoreButton>
|
|
46
|
+
<ReqoreTag label='A wild tag appears!' color='main:lighten:2' />
|
|
39
47
|
<ReqoreInput icon='4KFill' value='Hello' />
|
|
40
48
|
<ReqoreButton disabled fixed>
|
|
41
49
|
Disabled & Fixed
|
|
@@ -161,6 +161,32 @@ const Template: Story<IReqoreDropdownProps> = (args: IReqoreDropdownProps) => {
|
|
|
161
161
|
<ReqoreDropdown rightIcon='SunCloudyLine' caretPosition='right' {...args}>
|
|
162
162
|
Custom icon with caret on right
|
|
163
163
|
</ReqoreDropdown>
|
|
164
|
+
<ReqoreDropdown
|
|
165
|
+
items={[
|
|
166
|
+
{
|
|
167
|
+
selected: true,
|
|
168
|
+
label: 'Hello',
|
|
169
|
+
value: 'hello',
|
|
170
|
+
icon: 'SunCloudyLine',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: 'How are ya',
|
|
174
|
+
value: 'howareya',
|
|
175
|
+
icon: 'BatteryChargeFill',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
disabled: true,
|
|
179
|
+
label: 'i aM diSAblEd',
|
|
180
|
+
value: 'disabled',
|
|
181
|
+
icon: 'StopCircleLine',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
label: 'With right button',
|
|
185
|
+
value: 'kek',
|
|
186
|
+
icon: 'CheckDoubleLine',
|
|
187
|
+
},
|
|
188
|
+
]}
|
|
189
|
+
/>
|
|
164
190
|
</ReqoreControlGroup>
|
|
165
191
|
<br />
|
|
166
192
|
<ReqoreControlGroup fluid>
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
2
|
import { IReqoreMenuProps } from '../../components/Menu';
|
|
3
3
|
import { IReqoreMenuItemProps } from '../../components/Menu/item';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ReqoreInput,
|
|
6
|
+
ReqoreMenu,
|
|
7
|
+
ReqoreMenuDivider,
|
|
8
|
+
ReqoreMenuItem,
|
|
9
|
+
ReqorePopover,
|
|
10
|
+
} from '../../index';
|
|
5
11
|
import { IntentArg, argManager } from '../utils/args';
|
|
6
12
|
|
|
7
13
|
const { createArg } = argManager<IReqoreMenuProps>();
|
|
@@ -11,7 +17,7 @@ export default {
|
|
|
11
17
|
argTypes: {
|
|
12
18
|
...createArg('width', {
|
|
13
19
|
type: 'string',
|
|
14
|
-
defaultValue: '
|
|
20
|
+
defaultValue: '210px',
|
|
15
21
|
name: 'Width',
|
|
16
22
|
}),
|
|
17
23
|
...createArg('maxHeight', {
|
|
@@ -35,6 +41,38 @@ export default {
|
|
|
35
41
|
},
|
|
36
42
|
description: 'Whether to wrap text or not',
|
|
37
43
|
}),
|
|
44
|
+
...createArg('minimal', {
|
|
45
|
+
defaultValue: false,
|
|
46
|
+
name: 'Minimal',
|
|
47
|
+
control: {
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
},
|
|
50
|
+
description: 'Whether to use minimal style or not',
|
|
51
|
+
}),
|
|
52
|
+
...createArg('flat', {
|
|
53
|
+
defaultValue: true,
|
|
54
|
+
name: 'Flat',
|
|
55
|
+
control: {
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
},
|
|
58
|
+
description: 'Whether to use flat style or not',
|
|
59
|
+
}),
|
|
60
|
+
...createArg('rounded', {
|
|
61
|
+
defaultValue: true,
|
|
62
|
+
name: 'Rounded',
|
|
63
|
+
control: {
|
|
64
|
+
type: 'boolean',
|
|
65
|
+
},
|
|
66
|
+
description: 'Whether to use rounded style or not',
|
|
67
|
+
}),
|
|
68
|
+
...createArg('transparent', {
|
|
69
|
+
defaultValue: false,
|
|
70
|
+
name: 'Transparent',
|
|
71
|
+
control: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
},
|
|
74
|
+
description: 'Whether to use transparent style or not',
|
|
75
|
+
}),
|
|
38
76
|
...IntentArg,
|
|
39
77
|
},
|
|
40
78
|
} as Meta<IReqoreMenuProps>;
|
|
@@ -42,10 +80,13 @@ export default {
|
|
|
42
80
|
const Template: Story<IReqoreMenuProps> = (args) => {
|
|
43
81
|
return (
|
|
44
82
|
<ReqoreMenu {...args}>
|
|
83
|
+
<ReqoreInput placeholder='Custom component' icon='Search2Fill' flat={false} />
|
|
45
84
|
<ReqoreMenuItem icon='Save3Fill' intent='success' selected>
|
|
46
85
|
Selected success
|
|
47
86
|
</ReqoreMenuItem>
|
|
48
|
-
<ReqoreMenuItem icon='Save3Fill'>
|
|
87
|
+
<ReqoreMenuItem icon='Save3Fill' badge={10}>
|
|
88
|
+
Save
|
|
89
|
+
</ReqoreMenuItem>
|
|
49
90
|
<ReqoreMenuDivider label='BIG Divider' size='huge' />
|
|
50
91
|
<ReqoreMenuItem
|
|
51
92
|
icon='ChatPollFill'
|
|
@@ -143,7 +184,15 @@ export const WrappedText = Template.bind({});
|
|
|
143
184
|
WrappedText.args = {
|
|
144
185
|
wrapText: true,
|
|
145
186
|
};
|
|
187
|
+
export const Minimal = Template.bind({});
|
|
188
|
+
Minimal.args = {
|
|
189
|
+
minimal: true,
|
|
190
|
+
};
|
|
146
191
|
export const NotFlat = Template.bind({});
|
|
147
192
|
NotFlat.args = {
|
|
148
193
|
flat: false,
|
|
149
194
|
};
|
|
195
|
+
export const Transparent = Template.bind({});
|
|
196
|
+
Transparent.args = {
|
|
197
|
+
transparent: true,
|
|
198
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
2
|
import { noop } from 'lodash';
|
|
3
3
|
import ReqoreMessage, { IReqoreMessageProps } from '../../components/Message';
|
|
4
|
-
import { FlatArg, IntentArg, SizeArg
|
|
4
|
+
import { argManager, FlatArg, IntentArg, SizeArg } from '../utils/args';
|
|
5
5
|
|
|
6
6
|
const { createArg } = argManager<IReqoreMessageProps>();
|
|
7
7
|
|
|
@@ -64,10 +64,9 @@ Effect.args = {
|
|
|
64
64
|
effect: {
|
|
65
65
|
gradient: {
|
|
66
66
|
colors: {
|
|
67
|
-
0: '#
|
|
68
|
-
100: '
|
|
67
|
+
0: '#eb0e8c',
|
|
68
|
+
100: 'danger:darken:2',
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
|
-
color: '#000000',
|
|
72
71
|
},
|
|
73
72
|
};
|
|
@@ -3,7 +3,7 @@ import { noop } from 'lodash';
|
|
|
3
3
|
import { IReqoreTagProps } from '../../components/Tag';
|
|
4
4
|
import { IReqoreTagGroup } from '../../components/Tag/group';
|
|
5
5
|
import { ReqoreTag, ReqoreTagGroup } from '../../index';
|
|
6
|
-
import {
|
|
6
|
+
import { SizeArg, argManager } from '../utils/args';
|
|
7
7
|
|
|
8
8
|
const { createArg } = argManager<IReqoreTagGroup & IReqoreTagProps>();
|
|
9
9
|
|
|
@@ -156,6 +156,30 @@ const Template: Story<IReqoreTagGroup & IReqoreTagProps> = ({ columns, ...args }
|
|
|
156
156
|
},
|
|
157
157
|
]}
|
|
158
158
|
/>
|
|
159
|
+
<ReqoreTag
|
|
160
|
+
{...args}
|
|
161
|
+
labelKey='This is the key for a wrapped tag'
|
|
162
|
+
label='Wrapped tag with some long text and NO width specified, AND wrap specified'
|
|
163
|
+
icon='ShareForward2Fill'
|
|
164
|
+
rightIcon={args.rightIcon}
|
|
165
|
+
wrap
|
|
166
|
+
onRemoveClick={null}
|
|
167
|
+
actions={[
|
|
168
|
+
{
|
|
169
|
+
icon: '24HoursFill',
|
|
170
|
+
onClick: noop,
|
|
171
|
+
disabled: true,
|
|
172
|
+
intent: 'info',
|
|
173
|
+
tooltip: { content: 'I am a tooltip' },
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
icon: 'SpyFill',
|
|
177
|
+
onClick: noop,
|
|
178
|
+
intent: 'success',
|
|
179
|
+
tooltip: { content: 'Hm, another tooltip', openOnMount: true },
|
|
180
|
+
},
|
|
181
|
+
]}
|
|
182
|
+
/>
|
|
159
183
|
</ReqoreTagGroup>
|
|
160
184
|
);
|
|
161
185
|
};
|
package/src/types/global.ts
CHANGED
|
@@ -140,6 +140,20 @@ export interface IWithReqoreMinimal {
|
|
|
140
140
|
minimal?: boolean;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
export interface IWithReqoreTransparent {
|
|
144
|
+
/**
|
|
145
|
+
* If true, the component will be transparent
|
|
146
|
+
* @default false
|
|
147
|
+
* @type boolean
|
|
148
|
+
* @example
|
|
149
|
+
* <ReqoreButton transparent />
|
|
150
|
+
* <ReqoreButton transparent={true} />
|
|
151
|
+
* <ReqoreButton transparent={false} />
|
|
152
|
+
*
|
|
153
|
+
*/
|
|
154
|
+
transparent?: boolean;
|
|
155
|
+
}
|
|
156
|
+
|
|
143
157
|
export interface IWithReqoreEffect {
|
|
144
158
|
/**
|
|
145
159
|
* If true, the component will have an effect
|