@qoretechnologies/reqore 0.23.0 → 0.25.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__/collection.test.tsx +72 -0
- package/__tests__/panel.test.tsx +35 -2
- package/__tests__/tag.test.tsx +21 -7
- package/dist/components/Collection/index.d.ts +17 -0
- package/dist/components/Collection/index.d.ts.map +1 -0
- package/dist/components/Collection/index.js +165 -0
- package/dist/components/Collection/index.js.map +1 -0
- package/dist/components/Collection/item.d.ts +18 -0
- package/dist/components/Collection/item.d.ts.map +1 -0
- package/dist/components/Collection/item.js +168 -0
- package/dist/components/Collection/item.js.map +1 -0
- package/dist/components/Columns/index.d.ts.map +1 -1
- package/dist/components/Columns/index.js +1 -1
- package/dist/components/Columns/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +5 -3
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +1 -1
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +2 -1
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/InternalPopover/index.js +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +5 -2
- 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 +2 -2
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Panel/index.d.ts +12 -12
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +66 -36
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Spacer/index.d.ts +2 -0
- package/dist/components/Spacer/index.d.ts.map +1 -0
- package/dist/components/Spacer/index.js +20 -0
- package/dist/components/Spacer/index.js.map +1 -0
- package/dist/components/Table/index.d.ts +4 -4
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +2 -2
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Tag/index.d.ts +2 -1
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +11 -10
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/constants/theme.d.ts +3 -0
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/constants/theme.js +9 -1
- package/dist/constants/theme.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +1 -0
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +5 -4
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/hooks/useTooltip.d.ts +2 -2
- package/dist/hooks/useTooltip.d.ts.map +1 -1
- package/dist/hooks/useTooltip.js +11 -2
- package/dist/hooks/useTooltip.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/types/global.d.ts +29 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/components/Collection/index.tsx +189 -0
- package/src/components/Collection/item.tsx +239 -0
- package/src/components/Columns/index.tsx +1 -0
- package/src/components/ControlGroup/index.tsx +5 -2
- package/src/components/Drawer/index.tsx +1 -1
- package/src/components/Dropdown/index.tsx +1 -0
- package/src/components/Dropdown/list.tsx +11 -7
- package/src/components/InternalPopover/index.tsx +1 -1
- package/src/components/Menu/index.tsx +2 -1
- package/src/components/Menu/item.tsx +4 -2
- package/src/components/Panel/index.tsx +188 -117
- package/src/components/Spacer/index.tsx +7 -0
- package/src/components/Table/index.tsx +7 -7
- package/src/components/Table/row.tsx +2 -2
- package/src/components/Tag/index.tsx +27 -5
- package/src/constants/theme.ts +9 -0
- package/src/hooks/usePopover.tsx +6 -4
- package/src/hooks/useTooltip.ts +15 -4
- package/src/index.tsx +2 -0
- package/src/mock/collectionData.tsx +228 -0
- package/src/stories/Collection/Collection.stories.tsx +98 -0
- package/src/stories/Columns/Columns.stories.tsx +1 -1
- package/src/stories/Dropdown/Dropdown.stories.tsx +1 -1
- package/src/stories/Panel/Panel.stories.tsx +22 -0
- package/src/stories/Tag/Tag.stories.tsx +2 -0
- package/src/types/global.ts +31 -0
- package/tests.json +1 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { size } from 'lodash';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { ReqoreIntents } from '../../constants/theme';
|
|
5
|
+
import { IReqoreColumnsProps, StyledColumns } from '../Columns';
|
|
6
|
+
import ReqoreInput from '../Input';
|
|
7
|
+
import ReqoreMessage from '../Message';
|
|
8
|
+
import { IReqorePanelAction, IReqorePanelProps, ReqorePanel } from '../Panel';
|
|
9
|
+
import { sortTableData } from '../Table/helpers';
|
|
10
|
+
import { IReqoreCollectionItemProps, ReqoreCollectionItem } from './item';
|
|
11
|
+
|
|
12
|
+
export interface IReqoreCollectionProps
|
|
13
|
+
extends Pick<
|
|
14
|
+
IReqorePanelProps,
|
|
15
|
+
'size' | 'intent' | 'customTheme' | 'actions' | 'bottomActions' | 'label'
|
|
16
|
+
>,
|
|
17
|
+
IReqoreColumnsProps {
|
|
18
|
+
items?: IReqoreCollectionItemProps[];
|
|
19
|
+
stacked?: boolean;
|
|
20
|
+
rounded?: boolean;
|
|
21
|
+
height?: string;
|
|
22
|
+
fill?: boolean;
|
|
23
|
+
maxItemHeight?: number;
|
|
24
|
+
filterable?: boolean;
|
|
25
|
+
sortable?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const StyledCollectionWrapper = styled(StyledColumns)`
|
|
29
|
+
height: ${({ height }) => (height ? `${height}px` : 'auto')};
|
|
30
|
+
|
|
31
|
+
${({ rounded, stacked }: IReqoreCollectionProps) =>
|
|
32
|
+
(!rounded || stacked) &&
|
|
33
|
+
css`
|
|
34
|
+
border-radius: ${stacked && rounded ? '10px' : undefined};
|
|
35
|
+
`}
|
|
36
|
+
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
position: relative;
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export const ReqoreCollection = ({
|
|
42
|
+
items,
|
|
43
|
+
columnsGap = '10px',
|
|
44
|
+
stacked,
|
|
45
|
+
rounded = true,
|
|
46
|
+
fill,
|
|
47
|
+
height,
|
|
48
|
+
maxItemHeight,
|
|
49
|
+
filterable,
|
|
50
|
+
sortable,
|
|
51
|
+
...rest
|
|
52
|
+
}: IReqoreCollectionProps) => {
|
|
53
|
+
const [showAs, setShowAs] = useState<'list' | 'grid'>('grid');
|
|
54
|
+
const [sort, setSort] = useState<'asc' | 'desc'>('asc');
|
|
55
|
+
const [query, setQuery] = useState<string>('');
|
|
56
|
+
|
|
57
|
+
const sortedItems: IReqoreCollectionItemProps[] = useMemo(
|
|
58
|
+
() => (sortable ? sortTableData(items, { by: 'label', direction: sort }) : items),
|
|
59
|
+
[items, sort]
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const filteredItems: IReqoreCollectionItemProps[] = useMemo(() => {
|
|
63
|
+
if (!filterable || query === '') {
|
|
64
|
+
return sortedItems;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return sortedItems.filter((item) => {
|
|
68
|
+
const text = `${item.label}${item.content?.toString()}${item.expandedContent?.toString()}`;
|
|
69
|
+
|
|
70
|
+
if (!text) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return text.toString().toLowerCase().indexOf(query.toLowerCase()) !== -1;
|
|
75
|
+
});
|
|
76
|
+
}, [items, query, sortedItems]);
|
|
77
|
+
|
|
78
|
+
const handleQueryChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
79
|
+
setQuery(event.target.value);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const finalItems = filteredItems;
|
|
83
|
+
const finalActions: (IReqorePanelAction[] | IReqorePanelAction)[] = useMemo(() => {
|
|
84
|
+
let actions = [];
|
|
85
|
+
|
|
86
|
+
if (filterable) {
|
|
87
|
+
actions = [
|
|
88
|
+
...actions,
|
|
89
|
+
{
|
|
90
|
+
customContent: () => (
|
|
91
|
+
<ReqoreInput
|
|
92
|
+
placeholder={`Filter ${size(items)} items`}
|
|
93
|
+
onClearClick={() => setQuery('')}
|
|
94
|
+
onChange={handleQueryChange}
|
|
95
|
+
value={query}
|
|
96
|
+
icon='Search2Line'
|
|
97
|
+
minimal={false}
|
|
98
|
+
/>
|
|
99
|
+
),
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (sortable) {
|
|
105
|
+
actions = [
|
|
106
|
+
...actions,
|
|
107
|
+
[
|
|
108
|
+
{
|
|
109
|
+
icon: 'SortAsc',
|
|
110
|
+
intent: sort === 'asc' ? ReqoreIntents.INFO : undefined,
|
|
111
|
+
onClick: () => setSort('asc'),
|
|
112
|
+
active: sort === 'asc',
|
|
113
|
+
tooltip: 'Sort ascending',
|
|
114
|
+
disabled: !size(finalItems),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
icon: 'SortDesc',
|
|
118
|
+
intent: sort === 'desc' ? ReqoreIntents.INFO : undefined,
|
|
119
|
+
onClick: () => setSort('desc'),
|
|
120
|
+
active: sort === 'desc',
|
|
121
|
+
tooltip: 'Sort descending',
|
|
122
|
+
disabled: !size(finalItems),
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return [
|
|
129
|
+
...actions,
|
|
130
|
+
[
|
|
131
|
+
{
|
|
132
|
+
icon: 'GridLine',
|
|
133
|
+
onClick: () => setShowAs('grid'),
|
|
134
|
+
intent: showAs === 'grid' ? ReqoreIntents.INFO : undefined,
|
|
135
|
+
active: showAs === 'grid',
|
|
136
|
+
tooltip: 'Show as grid',
|
|
137
|
+
disabled: !size(finalItems),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
icon: 'ListOrdered',
|
|
141
|
+
onClick: () => setShowAs('list'),
|
|
142
|
+
intent: showAs === 'list' ? ReqoreIntents.INFO : undefined,
|
|
143
|
+
active: showAs === 'list',
|
|
144
|
+
tooltip: 'Show as list',
|
|
145
|
+
disabled: !size(finalItems),
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
...(rest.actions || []),
|
|
149
|
+
];
|
|
150
|
+
}, [filterable, handleQueryChange, query, rest.actions, showAs, sort, sortable, finalItems]);
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<ReqorePanel
|
|
154
|
+
{...rest}
|
|
155
|
+
style={{
|
|
156
|
+
height: height ?? undefined,
|
|
157
|
+
}}
|
|
158
|
+
fill={fill}
|
|
159
|
+
headerSize={2}
|
|
160
|
+
padded
|
|
161
|
+
opacity={0}
|
|
162
|
+
actions={finalActions}
|
|
163
|
+
className={`reqore-collection ${rest.className || ''}`}
|
|
164
|
+
>
|
|
165
|
+
{!size(finalItems) ? (
|
|
166
|
+
<ReqoreMessage intent='muted' flat title='No items found'>
|
|
167
|
+
No data in this collection, try changing your search query or filters
|
|
168
|
+
</ReqoreMessage>
|
|
169
|
+
) : (
|
|
170
|
+
<StyledCollectionWrapper
|
|
171
|
+
columns={showAs === 'grid' ? 'auto-fit' : 1}
|
|
172
|
+
columnsGap={stacked ? '0px' : columnsGap}
|
|
173
|
+
rounded={rounded}
|
|
174
|
+
stacked={stacked}
|
|
175
|
+
{...rest}
|
|
176
|
+
>
|
|
177
|
+
{finalItems?.map((item) => (
|
|
178
|
+
<ReqoreCollectionItem
|
|
179
|
+
{...item}
|
|
180
|
+
key={item.id || item.label.toString()}
|
|
181
|
+
rounded={!stacked}
|
|
182
|
+
maxContentHeight={maxItemHeight}
|
|
183
|
+
/>
|
|
184
|
+
))}
|
|
185
|
+
</StyledCollectionWrapper>
|
|
186
|
+
)}
|
|
187
|
+
</ReqorePanel>
|
|
188
|
+
);
|
|
189
|
+
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { map, size } from 'lodash';
|
|
2
|
+
import { rgba } from 'polished';
|
|
3
|
+
import { useContext, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useDebounce, useMeasure } from 'react-use';
|
|
5
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
import ReqoreContext from '../../context/ReqoreContext';
|
|
7
|
+
import { changeDarkness, getMainBackgroundColor } from '../../helpers/colors';
|
|
8
|
+
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
9
|
+
import { StyledBackdrop } from '../Drawer';
|
|
10
|
+
import { IReqoreDropdownItemProps } from '../Dropdown/item';
|
|
11
|
+
import {
|
|
12
|
+
IReqorePanelAction,
|
|
13
|
+
IReqorePanelBottomAction,
|
|
14
|
+
IReqorePanelProps,
|
|
15
|
+
ReqorePanel,
|
|
16
|
+
} from '../Panel';
|
|
17
|
+
import { ReqoreSpacer } from '../Spacer';
|
|
18
|
+
import ReqoreTag, { IReqoreTagProps } from '../Tag';
|
|
19
|
+
import ReqoreTagGroup from '../Tag/group';
|
|
20
|
+
|
|
21
|
+
export interface IReqoreCollectionItemProps
|
|
22
|
+
extends Omit<
|
|
23
|
+
IReqorePanelProps,
|
|
24
|
+
| 'children'
|
|
25
|
+
| 'actions'
|
|
26
|
+
| 'collapsible'
|
|
27
|
+
| 'onCollapseChange'
|
|
28
|
+
| 'isCollapsed'
|
|
29
|
+
| 'unMountContentOnCollapse'
|
|
30
|
+
| 'bottomActions'
|
|
31
|
+
> {
|
|
32
|
+
subHeader?: string;
|
|
33
|
+
content?: string | React.ReactNode;
|
|
34
|
+
expandable?: boolean;
|
|
35
|
+
expandedContent?: string | React.ReactNode;
|
|
36
|
+
expandedActions?: IReqorePanelBottomAction[];
|
|
37
|
+
image?: string;
|
|
38
|
+
actions?: IReqoreDropdownItemProps[];
|
|
39
|
+
tags?: IReqoreTagProps[];
|
|
40
|
+
maxContentHeight?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const StyledCollectionItemContent = styled.div`
|
|
44
|
+
max-height: ${({ providedHeight }) => (providedHeight ? `${providedHeight}px` : 'auto')};
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
position: relative;
|
|
47
|
+
transition: 0.3s ease-in-out;
|
|
48
|
+
|
|
49
|
+
${({ contentOverflows, theme, opacity = 1 }) =>
|
|
50
|
+
contentOverflows &&
|
|
51
|
+
css`
|
|
52
|
+
&:after {
|
|
53
|
+
content: '';
|
|
54
|
+
position: absolute;
|
|
55
|
+
bottom: 0;
|
|
56
|
+
left: 0;
|
|
57
|
+
right: 0;
|
|
58
|
+
height: 100px;
|
|
59
|
+
transition: 0.3s ease-in-out;
|
|
60
|
+
background: linear-gradient(
|
|
61
|
+
to top,
|
|
62
|
+
${rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)} 0%,
|
|
63
|
+
transparent 100%
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
`}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export const ReqoreCollectionItem = ({
|
|
70
|
+
flat = true,
|
|
71
|
+
minimal = true,
|
|
72
|
+
style,
|
|
73
|
+
content,
|
|
74
|
+
actions,
|
|
75
|
+
tags,
|
|
76
|
+
expandable,
|
|
77
|
+
expandedContent,
|
|
78
|
+
expandedActions,
|
|
79
|
+
maxContentHeight,
|
|
80
|
+
...rest
|
|
81
|
+
}: IReqoreCollectionItemProps) => {
|
|
82
|
+
const [isSelected, setIsSelected] = useState(false);
|
|
83
|
+
const { getAndIncreaseZIndex } = useContext(ReqoreContext);
|
|
84
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
85
|
+
const [contentRef, sizes] = useMeasure();
|
|
86
|
+
const originalDimensions = useRef(null);
|
|
87
|
+
const [position, setPosition] = useState(undefined);
|
|
88
|
+
const theme = useReqoreTheme('main', rest.customTheme, rest.intent);
|
|
89
|
+
const [dimensions, setDimensions] = useState<any>({
|
|
90
|
+
minWidth: undefined,
|
|
91
|
+
minHeight: undefined,
|
|
92
|
+
maxWidth: undefined,
|
|
93
|
+
maxHeight: undefined,
|
|
94
|
+
width: undefined,
|
|
95
|
+
height: undefined,
|
|
96
|
+
left: undefined,
|
|
97
|
+
top: undefined,
|
|
98
|
+
transform: undefined,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (isSelected) {
|
|
103
|
+
setPosition('fixed');
|
|
104
|
+
}
|
|
105
|
+
}, [isSelected]);
|
|
106
|
+
|
|
107
|
+
useDebounce(
|
|
108
|
+
() => {
|
|
109
|
+
if (isSelected) {
|
|
110
|
+
setDimensions({
|
|
111
|
+
...dimensions,
|
|
112
|
+
width: undefined,
|
|
113
|
+
height: undefined,
|
|
114
|
+
left: '50%',
|
|
115
|
+
minWidth: '500px',
|
|
116
|
+
minHeight: '300px',
|
|
117
|
+
maxWidth: '90vw',
|
|
118
|
+
maxHeight: '90vh',
|
|
119
|
+
top: '50%',
|
|
120
|
+
transform: 'translateX(-50%) translateY(-50%)',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
100,
|
|
125
|
+
[isSelected]
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
useDebounce(
|
|
129
|
+
() => {
|
|
130
|
+
if (!isSelected) {
|
|
131
|
+
setPosition(undefined);
|
|
132
|
+
setDimensions({
|
|
133
|
+
minHeight: undefined,
|
|
134
|
+
minWidth: undefined,
|
|
135
|
+
maxWidth: undefined,
|
|
136
|
+
maxHeight: undefined,
|
|
137
|
+
left: undefined,
|
|
138
|
+
top: undefined,
|
|
139
|
+
transform: 'translateX(0) translateY(0)',
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
220,
|
|
144
|
+
[isSelected]
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const renderContent = () => {
|
|
148
|
+
const handleItemClick = (event) => {
|
|
149
|
+
if (expandable) {
|
|
150
|
+
if (isSelected) {
|
|
151
|
+
setDimensions(originalDimensions.current);
|
|
152
|
+
} else {
|
|
153
|
+
originalDimensions.current = {
|
|
154
|
+
left: ref.current.getBoundingClientRect()?.left,
|
|
155
|
+
top: ref.current.getBoundingClientRect()?.top,
|
|
156
|
+
width: ref.current.getBoundingClientRect()?.width,
|
|
157
|
+
height: ref.current.getBoundingClientRect()?.height,
|
|
158
|
+
transform: 'translateX(0) translateY(0)',
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
setDimensions({
|
|
162
|
+
left: ref.current.getBoundingClientRect()?.left,
|
|
163
|
+
top: ref.current.getBoundingClientRect()?.top,
|
|
164
|
+
width: ref.current.getBoundingClientRect()?.width,
|
|
165
|
+
height: ref.current.getBoundingClientRect()?.height,
|
|
166
|
+
transform: 'translateX(0) translateY(0)',
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
setIsSelected(!isSelected);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
rest?.onClick?.(event);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const actualContent: string | React.ReactNode =
|
|
176
|
+
expandedContent && isSelected ? expandedContent : content;
|
|
177
|
+
|
|
178
|
+
const actualActions: IReqorePanelAction[] | undefined = isSelected
|
|
179
|
+
? [...(actions || []), { icon: 'CloseLine', onClick: handleItemClick }]
|
|
180
|
+
: size(actions)
|
|
181
|
+
? [{ icon: 'More2Fill', actions }]
|
|
182
|
+
: undefined;
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<>
|
|
186
|
+
{position && (
|
|
187
|
+
<>
|
|
188
|
+
<div style={{ ...originalDimensions.current }} />
|
|
189
|
+
<StyledBackdrop
|
|
190
|
+
zIndex={getAndIncreaseZIndex()}
|
|
191
|
+
blur={5}
|
|
192
|
+
closable
|
|
193
|
+
onClick={handleItemClick}
|
|
194
|
+
/>
|
|
195
|
+
</>
|
|
196
|
+
)}
|
|
197
|
+
<ReqorePanel
|
|
198
|
+
{...rest}
|
|
199
|
+
flat={flat}
|
|
200
|
+
headerSize={3}
|
|
201
|
+
ref={ref}
|
|
202
|
+
minimal={minimal}
|
|
203
|
+
bottomActions={isSelected ? expandedActions : undefined}
|
|
204
|
+
style={{
|
|
205
|
+
...style,
|
|
206
|
+
position,
|
|
207
|
+
zIndex: isSelected ? getAndIncreaseZIndex() : undefined,
|
|
208
|
+
...dimensions,
|
|
209
|
+
transformOrigin: 'center',
|
|
210
|
+
}}
|
|
211
|
+
onClick={(expandable && !isSelected) || rest.onClick ? handleItemClick : undefined}
|
|
212
|
+
actions={actualActions}
|
|
213
|
+
className={`reqore-collection-item ${rest.className || ''}`}
|
|
214
|
+
>
|
|
215
|
+
<StyledCollectionItemContent
|
|
216
|
+
theme={theme}
|
|
217
|
+
opacity={rest.opacity}
|
|
218
|
+
providedHeight={isSelected ? undefined : maxContentHeight}
|
|
219
|
+
contentOverflows={!isSelected && sizes?.height > maxContentHeight}
|
|
220
|
+
>
|
|
221
|
+
<div ref={contentRef}>{actualContent}</div>
|
|
222
|
+
</StyledCollectionItemContent>
|
|
223
|
+
{size(tags) ? (
|
|
224
|
+
<>
|
|
225
|
+
<ReqoreSpacer height={10} />
|
|
226
|
+
<ReqoreTagGroup size={isSelected ? 'normal' : 'small'}>
|
|
227
|
+
{map(tags, (tagProps, index) => (
|
|
228
|
+
<ReqoreTag key={index} {...tagProps} />
|
|
229
|
+
))}
|
|
230
|
+
</ReqoreTagGroup>
|
|
231
|
+
</>
|
|
232
|
+
) : null}
|
|
233
|
+
</ReqorePanel>
|
|
234
|
+
</>
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
return isSelected ? renderContent() : renderContent();
|
|
239
|
+
};
|
|
@@ -26,6 +26,7 @@ export const StyledColumns = styled.div<IStyledColumns>`
|
|
|
26
26
|
alignItems = 'normal',
|
|
27
27
|
}: IStyledColumns) => css`
|
|
28
28
|
grid-template-columns: repeat(${columns}, minmax(${minColumnWidth}, ${maxColumnWidth}));
|
|
29
|
+
grid-auto-rows: max-content;
|
|
29
30
|
grid-gap: ${columnsGap};
|
|
30
31
|
align-items: ${alignItems};
|
|
31
32
|
`}
|
|
@@ -69,8 +69,11 @@ const ReqoreControlGroup = ({
|
|
|
69
69
|
{React.Children.map(children, (child) =>
|
|
70
70
|
child
|
|
71
71
|
? React.cloneElement(child, {
|
|
72
|
-
minimal:
|
|
73
|
-
|
|
72
|
+
minimal:
|
|
73
|
+
child.props?.minimal || child.props?.minimal === false
|
|
74
|
+
? child.props.minimal
|
|
75
|
+
: minimal,
|
|
76
|
+
size: child.props?.size || size,
|
|
74
77
|
fluid,
|
|
75
78
|
})
|
|
76
79
|
: null
|
|
@@ -16,7 +16,7 @@ import { IReqorePanelAction, IReqorePanelProps, ReqorePanel } from '../Panel';
|
|
|
16
16
|
|
|
17
17
|
export type TPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
18
18
|
|
|
19
|
-
export interface IReqoreDrawerProps extends IReqorePanelProps {
|
|
19
|
+
export interface IReqoreDrawerProps extends Omit<IReqorePanelProps, 'size'> {
|
|
20
20
|
children?: any;
|
|
21
21
|
isOpen?: boolean;
|
|
22
22
|
isHidden?: boolean;
|
|
@@ -3,6 +3,7 @@ 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';
|
|
6
7
|
|
|
7
8
|
export interface IReqoreDropdownListProps extends IReqoreComponent {
|
|
8
9
|
items?: IReqoreMenuItemProps[];
|
|
@@ -58,13 +59,16 @@ const ReqoreDropdownList = ({
|
|
|
58
59
|
maxHeight={height || '300px'}
|
|
59
60
|
>
|
|
60
61
|
{filterable && (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
<>
|
|
63
|
+
<ReqoreInput
|
|
64
|
+
value={query}
|
|
65
|
+
onChange={handleQueryChange}
|
|
66
|
+
placeholder='Filter'
|
|
67
|
+
autoFocus
|
|
68
|
+
onClearClick={() => setQuery('')}
|
|
69
|
+
/>
|
|
70
|
+
<ReqoreSpacer height={10} />
|
|
71
|
+
</>
|
|
68
72
|
)}
|
|
69
73
|
{filteredItems.map((item: IReqoreMenuItemProps, index: number) => (
|
|
70
74
|
<ReqoreMenuItem key={index} {...item} rightIcon={item.selected ? 'CheckLine' : undefined} />
|
|
@@ -40,7 +40,7 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
|
40
40
|
z-index: 999999;
|
|
41
41
|
background-color: ${defaultColor};
|
|
42
42
|
color: ${getReadableColor(theme, undefined, undefined, false, defaultColor)};
|
|
43
|
-
border-radius:
|
|
43
|
+
border-radius: 5.5px;
|
|
44
44
|
box-shadow: rgba(31, 26, 34, 0.6) 0px 0px 4px;
|
|
45
45
|
`;
|
|
46
46
|
}}
|
|
@@ -22,7 +22,8 @@ export interface IReqoreMenuStyle extends IReqoreMenuProps {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const StyledReqoreMenu = styled.div<IReqoreMenuStyle>`
|
|
25
|
-
width: ${({ width }) => width ||
|
|
25
|
+
width: ${({ width }) => width || undefined};
|
|
26
|
+
min-width: ${({ width }) => (width ? undefined : '160px')};
|
|
26
27
|
padding: 5px;
|
|
27
28
|
max-height: ${({ maxHeight }) => maxHeight || undefined};
|
|
28
29
|
overflow-y: auto;
|
|
@@ -90,7 +90,7 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
|
90
90
|
useTooltip(targetRef.current, tooltip);
|
|
91
91
|
|
|
92
92
|
return (
|
|
93
|
-
<ReqoreControlGroup stack fluid>
|
|
93
|
+
<ReqoreControlGroup stack={!!onRightIconClick} fluid>
|
|
94
94
|
<ReqoreButton
|
|
95
95
|
//@ts-ignore
|
|
96
96
|
as={as}
|
|
@@ -113,11 +113,13 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
|
113
113
|
icon={rightIcon}
|
|
114
114
|
flat
|
|
115
115
|
fixed
|
|
116
|
+
minimal={!onRightIconClick}
|
|
116
117
|
customTheme={rest.customTheme}
|
|
117
118
|
className='reqore-menu-item-right-icon'
|
|
118
119
|
onClick={handleRightIconClick}
|
|
120
|
+
readOnly={!onRightIconClick}
|
|
119
121
|
intent={intent}
|
|
120
|
-
active={selected}
|
|
122
|
+
active={selected && !!onRightIconClick}
|
|
121
123
|
wrap={wrapText}
|
|
122
124
|
/>
|
|
123
125
|
)}
|