@qoretechnologies/reqore 0.28.6 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +2 -1
- package/__tests__/multiselect.test.tsx +361 -0
- package/__tests__/popover.test.tsx +35 -8
- package/dist/components/Collection/item.js +2 -2
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +3 -4
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +7 -9
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +2 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +3 -3
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +6 -3
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +19 -1
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Effect/index.d.ts +3 -1
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +24 -19
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Input/index.js +3 -3
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InputClearButton/index.d.ts.map +1 -1
- package/dist/components/InputClearButton/index.js +1 -1
- package/dist/components/InputClearButton/index.js.map +1 -1
- package/dist/components/InternalPopover/index.js +3 -3
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Menu/divider.d.ts +3 -2
- package/dist/components/Menu/divider.d.ts.map +1 -1
- package/dist/components/Menu/divider.js +2 -2
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Menu/index.js +4 -3
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +32 -0
- package/dist/components/MultiSelect/index.d.ts.map +1 -0
- package/dist/components/MultiSelect/index.js +177 -0
- package/dist/components/MultiSelect/index.js.map +1 -0
- 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/Popover/index.d.ts +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +5 -2
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Table/row.js +2 -2
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tabs/item.js +1 -1
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +5 -4
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.d.ts +3 -3
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +6 -3
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.js +5 -5
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Tree/index.js +1 -1
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/containers/PopoverProvider.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.js +28 -3
- package/dist/containers/PopoverProvider.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +6 -5
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +1 -0
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/PopoverContext.d.ts +1 -0
- package/dist/context/PopoverContext.d.ts.map +1 -1
- package/dist/context/PopoverContext.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +1 -0
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js +2 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.d.ts +3 -0
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +27 -3
- package/dist/helpers/colors.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +8 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +12 -7
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/hooks/useReqore.d.ts +3 -0
- package/dist/hooks/useReqore.d.ts.map +1 -0
- package/dist/hooks/useReqore.js +17 -0
- package/dist/hooks/useReqore.js.map +1 -0
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useTheme.js +3 -0
- package/dist/hooks/useTheme.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Collection/item.tsx +2 -2
- package/src/components/ControlGroup/index.tsx +46 -35
- package/src/components/Dropdown/index.tsx +5 -0
- package/src/components/Dropdown/list.tsx +29 -15
- package/src/components/Effect/index.tsx +58 -51
- package/src/components/Input/index.tsx +3 -3
- package/src/components/InputClearButton/index.tsx +1 -0
- package/src/components/InternalPopover/index.tsx +3 -3
- package/src/components/Menu/divider.tsx +15 -4
- package/src/components/Menu/index.tsx +3 -3
- package/src/components/MultiSelect/index.tsx +283 -0
- package/src/components/Panel/index.tsx +6 -4
- package/src/components/Popover/index.tsx +8 -3
- package/src/components/Table/row.tsx +2 -2
- package/src/components/Tabs/item.tsx +1 -1
- package/src/components/Tabs/list.tsx +11 -11
- package/src/components/Tag/group.tsx +10 -2
- package/src/components/Tag/index.tsx +7 -7
- package/src/components/Tree/index.tsx +3 -3
- package/src/containers/PopoverProvider.tsx +35 -3
- package/src/containers/ReqoreProvider.tsx +6 -4
- package/src/containers/UIProvider.tsx +1 -0
- package/src/context/PopoverContext.tsx +1 -0
- package/src/context/ReqoreContext.tsx +2 -0
- package/src/helpers/colors.ts +52 -4
- package/src/hooks/usePopover.tsx +24 -10
- package/src/hooks/useReqore.ts +12 -0
- package/src/hooks/useTheme.ts +6 -1
- package/src/index.tsx +3 -0
- package/src/mock/multiSelect.ts +61 -0
- package/src/stories/Button/Button.stories.tsx +20 -8
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +7 -2
- package/src/stories/Dropdown/Dropdown.stories.tsx +6 -1
- package/src/stories/Input/Input.stories.tsx +25 -0
- package/src/stories/Menu/Menu.stories.tsx +3 -2
- package/src/stories/MultiSelect/MultiSelect.stories.tsx +99 -0
- package/src/stories/Tabs/Tabs.stories.tsx +23 -3
- package/src/stories/Tag/Tag.stories.tsx +8 -1
- package/tests.json +1 -1
package/src/helpers/colors.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cloneDeep, merge } from 'lodash';
|
|
2
|
-
import { darken, getLuminance, lighten, readableColor } from 'polished';
|
|
1
|
+
import { cloneDeep, merge, reduce } from 'lodash';
|
|
2
|
+
import { darken, getLuminance, lighten, mix, readableColor } from 'polished';
|
|
3
3
|
import { TReqoreEffectColor, TReqoreEffectColorList, TReqoreHexColor } from '../components/Effect';
|
|
4
4
|
import { Colors } from '../constants/colors';
|
|
5
5
|
import { DEFAULT_INTENTS, IReqoreTheme, TReqoreIntent } from '../constants/theme';
|
|
@@ -124,14 +124,14 @@ export const mergeThemes = (element: string, theme: IReqoreTheme, customTheme: a
|
|
|
124
124
|
return clonedTheme;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
if (element === 'main'
|
|
127
|
+
if (element === 'main') {
|
|
128
128
|
merge(clonedTheme, {
|
|
129
129
|
main: customTheme.main,
|
|
130
130
|
originalMain: clonedTheme.main,
|
|
131
131
|
text: customTheme.text,
|
|
132
132
|
});
|
|
133
133
|
} else {
|
|
134
|
-
merge(clonedTheme, { [element]: customTheme
|
|
134
|
+
merge(clonedTheme, { [element]: customTheme, text: customTheme.text });
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
return clonedTheme;
|
|
@@ -189,3 +189,51 @@ export const getColorFromMaybeString = (
|
|
|
189
189
|
|
|
190
190
|
return _color;
|
|
191
191
|
};
|
|
192
|
+
|
|
193
|
+
export const createEffectGradient = (
|
|
194
|
+
theme: IReqoreTheme,
|
|
195
|
+
colors: Record<number, TReqoreEffectColor>,
|
|
196
|
+
lighten: number = 0,
|
|
197
|
+
minimal?: boolean
|
|
198
|
+
): string => {
|
|
199
|
+
return reduce(
|
|
200
|
+
colors,
|
|
201
|
+
(colorsString, color, percentage) => {
|
|
202
|
+
return `${colorsString}, ${
|
|
203
|
+
minimal ? theme.main : changeLightness(getColorFromMaybeString(theme, color), lighten)
|
|
204
|
+
} ${percentage}%`;
|
|
205
|
+
},
|
|
206
|
+
''
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export const getNthGradientColor = (
|
|
211
|
+
theme: IReqoreTheme,
|
|
212
|
+
colors?: Record<number, TReqoreEffectColor>,
|
|
213
|
+
nth: number = 1
|
|
214
|
+
): TReqoreHexColor | undefined => {
|
|
215
|
+
if (colors) {
|
|
216
|
+
return getColorFromMaybeString(theme, Object.values(colors)[nth - 1]);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return undefined;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const getGradientMix = (
|
|
223
|
+
theme: IReqoreTheme,
|
|
224
|
+
colors: Record<number, TReqoreEffectColor>,
|
|
225
|
+
fallback?: TReqoreHexColor
|
|
226
|
+
): TReqoreHexColor | undefined => {
|
|
227
|
+
if (colors && Object.keys(colors).length === 2) {
|
|
228
|
+
const gradientColor1: TReqoreHexColor = getNthGradientColor(theme, colors);
|
|
229
|
+
const gradientColor2: TReqoreHexColor = getNthGradientColor(theme, colors, 2);
|
|
230
|
+
|
|
231
|
+
return mix(
|
|
232
|
+
0.5,
|
|
233
|
+
gradientColor1 === '#00000000' ? theme.main : gradientColor1,
|
|
234
|
+
gradientColor2 === '#00000000' ? theme.main : gradientColor2
|
|
235
|
+
) as TReqoreHexColor;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return fallback;
|
|
239
|
+
};
|
package/src/hooks/usePopover.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { Placement } from '@popperjs/core';
|
|
|
2
2
|
import { MutableRefObject, useContext, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { useUnmount, useUpdateEffect } from 'react-use';
|
|
4
4
|
import shortid from 'shortid';
|
|
5
|
+
import { IPopoverData } from '../containers/PopoverProvider';
|
|
5
6
|
import PopoverContext from '../context/PopoverContext';
|
|
6
7
|
import {
|
|
7
8
|
IReqoreIntent,
|
|
@@ -25,6 +26,13 @@ const endEvents = {
|
|
|
25
26
|
focus: null,
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
export interface IPopoverControls {
|
|
30
|
+
open: () => void;
|
|
31
|
+
close: () => void;
|
|
32
|
+
isOpen: () => boolean;
|
|
33
|
+
id: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
export interface IPopover
|
|
29
37
|
extends IReqoreIntent,
|
|
30
38
|
IWithReqoreMinimal,
|
|
@@ -50,6 +58,7 @@ export interface IPopover
|
|
|
50
58
|
|
|
51
59
|
export interface IPopoverOptions extends IPopover {
|
|
52
60
|
targetElement?: HTMLElement;
|
|
61
|
+
passPopoverData?: (data: IPopoverControls) => void;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
const usePopover = ({
|
|
@@ -64,14 +73,15 @@ const usePopover = ({
|
|
|
64
73
|
openOnMount = false,
|
|
65
74
|
delay,
|
|
66
75
|
...rest
|
|
67
|
-
}: IPopoverOptions) => {
|
|
68
|
-
const { addPopover, removePopover, updatePopover, popovers } =
|
|
76
|
+
}: IPopoverOptions): IPopoverControls => {
|
|
77
|
+
const { addPopover, removePopover, updatePopover, popovers, isPopoverOpen } =
|
|
78
|
+
useContext(PopoverContext);
|
|
69
79
|
const { current }: MutableRefObject<string> = useRef(shortid.generate());
|
|
70
80
|
let { current: timeout }: MutableRefObject<any> = useRef(0);
|
|
71
81
|
|
|
72
82
|
const startEvent = startEvents[handler];
|
|
73
83
|
const endEvent = endEvents[handler];
|
|
74
|
-
const currentPopover = useMemo(
|
|
84
|
+
const currentPopover: IPopoverData = useMemo(
|
|
75
85
|
() => popovers?.find((p) => p.id === current),
|
|
76
86
|
[popovers, current]
|
|
77
87
|
);
|
|
@@ -97,7 +107,7 @@ const usePopover = ({
|
|
|
97
107
|
|
|
98
108
|
const _addPopover = () => {
|
|
99
109
|
if (currentPopover) {
|
|
100
|
-
if (handler !== 'hoverStay') {
|
|
110
|
+
if (handler !== 'hoverStay' && handler !== 'focus') {
|
|
101
111
|
_removePopover?.();
|
|
102
112
|
}
|
|
103
113
|
} else if (show) {
|
|
@@ -112,11 +122,6 @@ const usePopover = ({
|
|
|
112
122
|
};
|
|
113
123
|
|
|
114
124
|
const _removePopover = () => {
|
|
115
|
-
if (rest?.blur > 0) {
|
|
116
|
-
targetElement.style.position = 'initial';
|
|
117
|
-
targetElement.style.zIndex = 'initial';
|
|
118
|
-
}
|
|
119
|
-
|
|
120
125
|
cancelTimeout();
|
|
121
126
|
removePopover?.(current);
|
|
122
127
|
};
|
|
@@ -188,7 +193,16 @@ const usePopover = ({
|
|
|
188
193
|
cancelTimeout();
|
|
189
194
|
});
|
|
190
195
|
|
|
191
|
-
return
|
|
196
|
+
return {
|
|
197
|
+
id: current,
|
|
198
|
+
open: () => {
|
|
199
|
+
if (!isPopoverOpen(current)) {
|
|
200
|
+
openPopover();
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
close: () => _removePopover(),
|
|
204
|
+
isOpen: () => isPopoverOpen(current),
|
|
205
|
+
};
|
|
192
206
|
};
|
|
193
207
|
|
|
194
208
|
export default usePopover;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import ReqoreContext, { IReqoreContext } from '../context/ReqoreContext';
|
|
3
|
+
|
|
4
|
+
export const useReqore = (): IReqoreContext => {
|
|
5
|
+
const reqore = useContext(ReqoreContext);
|
|
6
|
+
|
|
7
|
+
if (!reqore) {
|
|
8
|
+
throw new Error('Reqore context is not defined');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return reqore;
|
|
12
|
+
};
|
package/src/hooks/useTheme.ts
CHANGED
|
@@ -14,11 +14,16 @@ export interface IReqoreCustomTheme extends Partial<Omit<IReqoreTheme, 'main' |
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export const useReqoreTheme = (
|
|
17
|
-
element
|
|
17
|
+
element?: string,
|
|
18
18
|
customTheme: IReqoreCustomTheme = {},
|
|
19
19
|
intent?: TReqoreIntent
|
|
20
20
|
) => {
|
|
21
21
|
const theme: IReqoreTheme = useContext<IReqoreTheme>(ThemeContext);
|
|
22
|
+
|
|
23
|
+
if (!element) {
|
|
24
|
+
return theme;
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
let _customTheme: IReqoreCustomTheme = cloneDeep(customTheme);
|
|
23
28
|
|
|
24
29
|
if (_customTheme.main) {
|
package/src/index.tsx
CHANGED
|
@@ -30,6 +30,7 @@ export { default as ReqoreMenuDivider } from './components/Menu/divider';
|
|
|
30
30
|
export { default as ReqoreMenuItem } from './components/Menu/item';
|
|
31
31
|
export { default as ReqoreMessage } from './components/Message';
|
|
32
32
|
export { ReqoreModal } from './components/Modal';
|
|
33
|
+
export { ReqoreMultiSelect } from './components/MultiSelect';
|
|
33
34
|
export { ReqoreFooter, ReqoreHeader } from './components/Navbar';
|
|
34
35
|
export { default as ReqoreNavbarDivider } from './components/Navbar/divider';
|
|
35
36
|
export { default as ReqoreNavbarGroup } from './components/Navbar/group';
|
|
@@ -58,3 +59,5 @@ export { default as ReqoreUIProvider } from './containers/UIProvider';
|
|
|
58
59
|
export { default as ReqoreContext } from './context/ReqoreContext';
|
|
59
60
|
export { default as ReqoreThemeContext } from './context/ThemeContext';
|
|
60
61
|
export { default as useLatestZIndex } from './hooks/useLatestZIndex';
|
|
62
|
+
export { useReqore } from './hooks/useReqore';
|
|
63
|
+
export { useReqoreTheme } from './hooks/useTheme';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { TReqoreMultiSelectItem } from '../components/MultiSelect';
|
|
2
|
+
|
|
3
|
+
export const MultiSelectItems: TReqoreMultiSelectItem[] = [
|
|
4
|
+
{
|
|
5
|
+
label: 'Existing item 1',
|
|
6
|
+
value: 'Existing item 1',
|
|
7
|
+
icon: 'SunCloudyLine',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
label: 'Existing item 2',
|
|
11
|
+
value: 'Existing item 2',
|
|
12
|
+
icon: 'BatteryChargeFill',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Existing item 3',
|
|
16
|
+
value: 'Existing item 3',
|
|
17
|
+
icon: 'DropboxFill',
|
|
18
|
+
intent: 'info',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: 'Existing item 4',
|
|
22
|
+
value: 'Existing item 4',
|
|
23
|
+
icon: 'PagesLine',
|
|
24
|
+
effect: { gradient: { colors: { 0: 'success', 100: 'info:darken:1' } } },
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
disabled: true,
|
|
28
|
+
label: 'Disabled item',
|
|
29
|
+
value: 'Disabled item',
|
|
30
|
+
icon: 'StopCircleLine',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
minimal: true,
|
|
34
|
+
label: 'Minimal item',
|
|
35
|
+
value: 'Minimal item',
|
|
36
|
+
icon: 'StopCircleLine',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
divider: true,
|
|
40
|
+
icon: 'CheckDoubleLine',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: 'itemWithNoLabel',
|
|
44
|
+
icon: 'TakeawayLine',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: 'Other Item 1',
|
|
48
|
+
value: 'Other Item 1',
|
|
49
|
+
icon: 'MapFill',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: 'Other Item 2',
|
|
53
|
+
value: 'Other Item 2',
|
|
54
|
+
icon: 'ArrowLeftUpFill',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: 'Other Item 3',
|
|
58
|
+
value: 'Other Item 3',
|
|
59
|
+
icon: 'MicLine',
|
|
60
|
+
},
|
|
61
|
+
];
|
|
@@ -32,17 +32,29 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
32
32
|
<ReqoreButton {...buttonProps} active tooltip='hello'>
|
|
33
33
|
Active
|
|
34
34
|
</ReqoreButton>
|
|
35
|
+
<ReqoreButton {...buttonProps} minimal flat>
|
|
36
|
+
Minimal
|
|
37
|
+
</ReqoreButton>
|
|
38
|
+
<ReqoreButton {...buttonProps} readOnly onClick={alert}>
|
|
39
|
+
Read only
|
|
40
|
+
</ReqoreButton>
|
|
41
|
+
</ReqoreControlGroup>
|
|
42
|
+
<br />
|
|
43
|
+
<ReqoreControlGroup size={buttonProps.size}>
|
|
44
|
+
<ReqoreButton {...buttonProps} active flat={false} tooltip='hello'>
|
|
45
|
+
Active Not Flat
|
|
46
|
+
</ReqoreButton>
|
|
35
47
|
<ReqoreButton {...buttonProps} flat={false}>
|
|
36
48
|
Not Flat
|
|
37
49
|
</ReqoreButton>
|
|
38
|
-
<ReqoreButton {...buttonProps} minimal>
|
|
39
|
-
Minimal
|
|
50
|
+
<ReqoreButton {...buttonProps} minimal flat={false}>
|
|
51
|
+
Minimal not flat
|
|
40
52
|
</ReqoreButton>
|
|
41
|
-
<ReqoreButton {...buttonProps}
|
|
42
|
-
|
|
53
|
+
<ReqoreButton {...buttonProps} readOnly onClick={alert} flat={false}>
|
|
54
|
+
Read only not flat
|
|
43
55
|
</ReqoreButton>
|
|
44
|
-
<ReqoreButton {...buttonProps}
|
|
45
|
-
|
|
56
|
+
<ReqoreButton {...buttonProps} disabled flat={false}>
|
|
57
|
+
Disabled not flat
|
|
46
58
|
</ReqoreButton>
|
|
47
59
|
</ReqoreControlGroup>
|
|
48
60
|
<br />
|
|
@@ -98,10 +110,10 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
98
110
|
<br />
|
|
99
111
|
<ReqoreControlGroup>
|
|
100
112
|
<ReqoreButton {...buttonProps} readOnly badge={10} onClick={alert}>
|
|
101
|
-
|
|
113
|
+
Read only with badge
|
|
102
114
|
</ReqoreButton>
|
|
103
115
|
<ReqoreButton {...buttonProps} minimal badge={20} onClick={alert}>
|
|
104
|
-
|
|
116
|
+
Minimal with badge
|
|
105
117
|
</ReqoreButton>
|
|
106
118
|
<ReqoreButton
|
|
107
119
|
{...buttonProps}
|
|
@@ -2,7 +2,7 @@ import { Meta, Story } from '@storybook/react/types-6-0';
|
|
|
2
2
|
import { IReqoreControlGroupProps } from '../../components/ControlGroup';
|
|
3
3
|
import ReqoreInput from '../../components/Input';
|
|
4
4
|
import { ReqoreButton, ReqoreControlGroup, ReqoreTag } from '../../index';
|
|
5
|
-
import { GapSizeArg, MinimalArg, SizeArg
|
|
5
|
+
import { argManager, GapSizeArg, MinimalArg, SizeArg } from '../utils/args';
|
|
6
6
|
|
|
7
7
|
const { createArg } = argManager<IReqoreControlGroupProps>();
|
|
8
8
|
|
|
@@ -39,7 +39,7 @@ const Template: Story<IReqoreControlGroupProps> = (args: IReqoreControlGroupProp
|
|
|
39
39
|
<ReqoreButton>Button</ReqoreButton>
|
|
40
40
|
<ReqoreButton
|
|
41
41
|
flat={false}
|
|
42
|
-
effect={{ gradient: { colors: { 0: 'success', 100: '
|
|
42
|
+
effect={{ gradient: { colors: { 0: 'success', 100: 'info:darken:1' } } }}
|
|
43
43
|
>
|
|
44
44
|
Non flat Button
|
|
45
45
|
</ReqoreButton>
|
|
@@ -60,6 +60,11 @@ Minimal.args = {
|
|
|
60
60
|
minimal: true,
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
export const NotFlat = Template.bind({});
|
|
64
|
+
NotFlat.args = {
|
|
65
|
+
flat: false,
|
|
66
|
+
};
|
|
67
|
+
|
|
63
68
|
export const Vertical = Template.bind({});
|
|
64
69
|
Vertical.args = {
|
|
65
70
|
vertical: true,
|
|
@@ -47,6 +47,11 @@ export default {
|
|
|
47
47
|
value: 'i aM diSAblEd',
|
|
48
48
|
icon: 'StopCircleLine',
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
divider: true,
|
|
52
|
+
label: 'Divider',
|
|
53
|
+
dividerAlign: 'left',
|
|
54
|
+
},
|
|
50
55
|
{
|
|
51
56
|
selected: true,
|
|
52
57
|
value: 'Hello',
|
|
@@ -125,7 +130,7 @@ export default {
|
|
|
125
130
|
} as Meta<IReqoreDropdownProps>;
|
|
126
131
|
|
|
127
132
|
const Template: Story<IReqoreDropdownProps> = (args: IReqoreDropdownProps) => {
|
|
128
|
-
const [selected, setSelected] = useState<string[]>(['Item 3', 'Item 6']);
|
|
133
|
+
const [selected, setSelected] = useState<(string | number)[]>(['Item 3', 'Item 6']);
|
|
129
134
|
|
|
130
135
|
if (args.multiSelect) {
|
|
131
136
|
return (
|
|
@@ -26,6 +26,31 @@ const Template: Story<IReqoreInputProps> = (args: IReqoreInputProps) => {
|
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<>
|
|
29
|
+
<ReqoreControlGroup>
|
|
30
|
+
<ReqoreInput {...args} placeholder='Reqore Input' onChange={handleValueChange} />
|
|
31
|
+
<ReqoreInput {...args} placeholder='Minimal Input' minimal onChange={handleValueChange} />
|
|
32
|
+
<ReqoreInput
|
|
33
|
+
{...args}
|
|
34
|
+
placeholder='Flat Input'
|
|
35
|
+
flat
|
|
36
|
+
tooltip="I'm a tooltip"
|
|
37
|
+
onChange={handleValueChange}
|
|
38
|
+
/>
|
|
39
|
+
<ReqoreInput
|
|
40
|
+
{...args}
|
|
41
|
+
placeholder='Clearable Input'
|
|
42
|
+
onClearClick={handleValueClear}
|
|
43
|
+
onChange={handleValueChange}
|
|
44
|
+
/>
|
|
45
|
+
<ReqoreInput {...args} placeholder='Disabled Input' disabled onChange={handleValueChange} />
|
|
46
|
+
<ReqoreInput
|
|
47
|
+
{...args}
|
|
48
|
+
placeholder='Read Only Input'
|
|
49
|
+
readOnly
|
|
50
|
+
onChange={handleValueChange}
|
|
51
|
+
/>
|
|
52
|
+
</ReqoreControlGroup>
|
|
53
|
+
<br />
|
|
29
54
|
<ReqoreControlGroup>
|
|
30
55
|
<ReqoreInput
|
|
31
56
|
{...args}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
ReqoreMenuItem,
|
|
9
9
|
ReqorePopover,
|
|
10
10
|
} from '../../index';
|
|
11
|
-
import {
|
|
11
|
+
import { argManager, IntentArg } from '../utils/args';
|
|
12
12
|
|
|
13
13
|
const { createArg } = argManager<IReqoreMenuProps>();
|
|
14
14
|
|
|
@@ -154,7 +154,8 @@ const Template: Story<IReqoreMenuProps> = (args) => {
|
|
|
154
154
|
</ReqorePopover>
|
|
155
155
|
<ReqoreMenuDivider
|
|
156
156
|
label='Fancy divider'
|
|
157
|
-
effect={{
|
|
157
|
+
effect={{ gradient: { colors: { 0: '#0d5ba5', 100: '#ff5dfd' } } }}
|
|
158
|
+
align='left'
|
|
158
159
|
/>
|
|
159
160
|
<ReqoreMenuItem icon='DualSim1Line' rightIcon='MoneyEuroBoxLine' selected>
|
|
160
161
|
I am selected!
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { IReqoreMultiSelectProps, ReqoreMultiSelect } from '../../components/MultiSelect';
|
|
4
|
+
import { MultiSelectItems } from '../../mock/multiSelect';
|
|
5
|
+
import { argManager, FlatArg, MinimalArg, SizeArg } from '../utils/args';
|
|
6
|
+
|
|
7
|
+
const { createArg } = argManager<IReqoreMultiSelectProps>();
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Components/MultiSelect',
|
|
11
|
+
parameters: {
|
|
12
|
+
chromatic: {
|
|
13
|
+
delay: 500,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
...FlatArg,
|
|
18
|
+
...MinimalArg(),
|
|
19
|
+
...SizeArg,
|
|
20
|
+
...createArg('canCreateItems', {
|
|
21
|
+
defaultValue: true,
|
|
22
|
+
name: 'Can create items',
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
}),
|
|
25
|
+
...createArg('canRemoveItems', {
|
|
26
|
+
defaultValue: true,
|
|
27
|
+
name: 'Can remove items',
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
} as Meta<IReqoreMultiSelectProps>;
|
|
32
|
+
|
|
33
|
+
const Template: Story<IReqoreMultiSelectProps> = (args: IReqoreMultiSelectProps) => {
|
|
34
|
+
const [selected, setSelected] = useState<string[]>([
|
|
35
|
+
'Existing item 1',
|
|
36
|
+
'Existing item 3',
|
|
37
|
+
'Disabled item',
|
|
38
|
+
'Minimal item with border',
|
|
39
|
+
'itemWithNoLabel',
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<ReqoreMultiSelect
|
|
44
|
+
value={selected}
|
|
45
|
+
{...args}
|
|
46
|
+
onValueChange={setSelected}
|
|
47
|
+
enterKeySelects
|
|
48
|
+
onItemClick={(item) => console.log('onItemClick', item)}
|
|
49
|
+
selectorProps={{
|
|
50
|
+
listHeight: '600px',
|
|
51
|
+
...args.selectorProps,
|
|
52
|
+
}}
|
|
53
|
+
items={MultiSelectItems}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Basic = Template.bind({});
|
|
59
|
+
export const Empty = Template.bind({});
|
|
60
|
+
Empty.args = {
|
|
61
|
+
value: [],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const AutoOpen = Template.bind({});
|
|
65
|
+
AutoOpen.args = {
|
|
66
|
+
openOnMount: true,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Flat = Template.bind({});
|
|
70
|
+
Flat.args = {
|
|
71
|
+
flat: true,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Minimal = Template.bind({});
|
|
75
|
+
Minimal.args = {
|
|
76
|
+
minimal: true,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const WithEffect = Template.bind({});
|
|
80
|
+
WithEffect.args = {
|
|
81
|
+
selectedItemEffect: {
|
|
82
|
+
gradient: {
|
|
83
|
+
colors: {
|
|
84
|
+
0: '#7f60ea',
|
|
85
|
+
100: '#00fd67',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
selectorProps: {
|
|
90
|
+
effect: {
|
|
91
|
+
gradient: {
|
|
92
|
+
colors: {
|
|
93
|
+
0: '#7f60ea',
|
|
94
|
+
100: '#00fd67',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
2
|
import { IReqoreTabsProps } from '../../components/Tabs';
|
|
3
3
|
import { ReqoreTabs, ReqoreTabsContent } from '../../index';
|
|
4
|
-
import { IntentArg, SizeArg
|
|
4
|
+
import { argManager, IntentArg, SizeArg } from '../utils/args';
|
|
5
5
|
|
|
6
6
|
const tabs = [
|
|
7
7
|
{
|
|
@@ -67,14 +67,34 @@ const tabs = [
|
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
|
-
label: '
|
|
70
|
+
label: 'With Effect',
|
|
71
71
|
id: 'tab8',
|
|
72
72
|
icon: 'MapPin3Line',
|
|
73
|
+
flat: false,
|
|
74
|
+
effect: {
|
|
75
|
+
gradient: {
|
|
76
|
+
colors: {
|
|
77
|
+
0: 'info',
|
|
78
|
+
100: 'danger',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
73
82
|
},
|
|
74
83
|
{
|
|
75
|
-
label: '
|
|
84
|
+
label: 'With another effect',
|
|
76
85
|
id: 'tab9',
|
|
77
86
|
icon: 'EjectLine',
|
|
87
|
+
effect: {
|
|
88
|
+
glow: {
|
|
89
|
+
color: 'warning',
|
|
90
|
+
blur: 16,
|
|
91
|
+
size: -5,
|
|
92
|
+
},
|
|
93
|
+
spaced: 3,
|
|
94
|
+
uppercase: true,
|
|
95
|
+
weight: 'thick',
|
|
96
|
+
textSize: 'small',
|
|
97
|
+
},
|
|
78
98
|
},
|
|
79
99
|
] as IReqoreTabsProps['tabs'];
|
|
80
100
|
|
|
@@ -60,7 +60,14 @@ const Template: Story<IReqoreTagGroup & IReqoreTagProps> = ({ columns, ...args }
|
|
|
60
60
|
return (
|
|
61
61
|
<ReqoreTagGroup columns={columns} size={args.size} gapSize={args.gapSize}>
|
|
62
62
|
<ReqoreTag {...args} actions={null} onRemoveClick={null} rightIcon={null} label={1} />
|
|
63
|
-
<ReqoreTag
|
|
63
|
+
<ReqoreTag
|
|
64
|
+
{...args}
|
|
65
|
+
actions={null}
|
|
66
|
+
onRemoveClick={null}
|
|
67
|
+
rightIcon={null}
|
|
68
|
+
label='Basic Tag'
|
|
69
|
+
onClick={() => console.log('Tag clicked')}
|
|
70
|
+
/>
|
|
64
71
|
<ReqoreTag
|
|
65
72
|
{...args}
|
|
66
73
|
actions={null}
|