@qoretechnologies/reqore 0.29.3 → 0.29.5
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 +1 -1
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +3 -3
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +6 -2
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +45 -15
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +3 -2
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +14 -7
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +11 -3
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +139 -46
- package/dist/components/ControlGroup/index.js.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/Icon/index.d.ts +2 -1
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +4 -1
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +2 -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 +6 -6
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Message/index.d.ts +2 -0
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +2 -2
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +2 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +2 -2
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +1 -2
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +2 -2
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Table/helpers.d.ts +3 -2
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +6 -3
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.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 +1 -1
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.d.ts +2 -2
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +7 -8
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.d.ts +3 -0
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +11 -11
- package/dist/components/Tag/index.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.map +1 -1
- package/dist/styles.d.ts +1 -0
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +6 -5
- package/dist/styles.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +14 -3
- package/src/components/Collection/index.tsx +60 -14
- package/src/components/Collection/item.tsx +16 -2
- package/src/components/ControlGroup/index.tsx +223 -107
- package/src/components/Dropdown/index.tsx +1 -0
- package/src/components/Icon/index.tsx +6 -3
- package/src/components/Input/index.tsx +4 -2
- package/src/components/InternalPopover/index.tsx +7 -6
- package/src/components/Message/index.tsx +9 -1
- package/src/components/Panel/index.tsx +3 -0
- package/src/components/Popover/index.tsx +1 -3
- package/src/components/Table/helpers.ts +12 -6
- package/src/components/Table/index.tsx +1 -0
- package/src/components/Tabs/item.tsx +4 -4
- package/src/components/Tabs/list.tsx +1 -0
- package/src/components/Tag/group.tsx +6 -12
- package/src/components/Tag/index.tsx +36 -13
- package/src/hooks/usePopover.tsx +1 -0
- package/src/mock/collectionData.tsx +10 -0
- package/src/stories/Button/Button.stories.tsx +14 -6
- package/src/stories/Checkbox/Checkbox.stories.tsx +4 -3
- package/src/stories/Collection/Collection.stories.tsx +18 -2
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +72 -31
- package/src/stories/Dropdown/Dropdown.stories.tsx +13 -3
- package/src/stories/Input/Input.stories.tsx +3 -2
- package/src/stories/Menu/Menu.stories.tsx +2 -0
- package/src/stories/Message/Message.stories.tsx +7 -0
- package/src/stories/Panel/Panel.stories.tsx +1 -0
- package/src/stories/Popover/Popover.stories.tsx +85 -79
- package/src/stories/Tabs/Tabs.stories.tsx +2 -1
- package/src/stories/Tag/Tag.stories.tsx +11 -1
- package/src/stories/TextArea/TextArea.stories.tsx +3 -3
- package/src/styles.ts +6 -0
- package/tests.json +1 -1
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import styled
|
|
1
|
+
import React, { forwardRef, memo, useMemo } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
3
|
import { GAP_FROM_SIZE, RADIUS_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
4
4
|
import { IReqoreTheme } from '../../constants/theme';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
IReqoreIntent,
|
|
7
|
+
IWithReqoreFlat,
|
|
8
|
+
IWithReqoreMinimal,
|
|
9
|
+
IWithReqoreSize,
|
|
10
|
+
} from '../../types/global';
|
|
6
11
|
|
|
7
12
|
export interface IReqoreControlGroupProps
|
|
8
13
|
extends React.HTMLAttributes<HTMLDivElement>,
|
|
9
14
|
IWithReqoreFlat,
|
|
10
15
|
IWithReqoreSize,
|
|
11
|
-
IWithReqoreMinimal
|
|
16
|
+
IWithReqoreMinimal,
|
|
17
|
+
IReqoreIntent {
|
|
12
18
|
stack?: boolean;
|
|
13
19
|
children: any;
|
|
14
20
|
fluid?: boolean;
|
|
@@ -18,6 +24,14 @@ export interface IReqoreControlGroupProps
|
|
|
18
24
|
* Whether the contents of the control group should be stacked vertically
|
|
19
25
|
*/
|
|
20
26
|
vertical?: boolean;
|
|
27
|
+
wrap?: boolean;
|
|
28
|
+
isInsideStackGroup?: boolean;
|
|
29
|
+
isInsideVerticalGroup?: boolean;
|
|
30
|
+
isFirst?: boolean;
|
|
31
|
+
isLast?: boolean;
|
|
32
|
+
isLastInFirstGroup?: boolean;
|
|
33
|
+
isLastInLastGroup?: boolean;
|
|
34
|
+
isFirstInLastGroup?: boolean;
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
export interface IReqoreControlGroupStyle extends IReqoreControlGroupProps {
|
|
@@ -30,117 +44,219 @@ export const StyledReqoreControlGroup = styled.div<IReqoreControlGroupStyle>`
|
|
|
30
44
|
width: ${({ fluid }) => (fluid ? '100%' : undefined)};
|
|
31
45
|
align-items: ${({ fluid }) => (fluid ? 'stretch' : 'flex-start')};
|
|
32
46
|
flex-flow: ${({ vertical }) => (vertical ? 'column' : 'row')};
|
|
47
|
+
gap: ${({ gapSize, stack }) => (!stack ? `${GAP_FROM_SIZE[gapSize]}px` : undefined)};
|
|
48
|
+
flex-wrap: ${({ wrap }) => (wrap ? 'wrap' : 'nowrap')};
|
|
33
49
|
|
|
34
|
-
>
|
|
50
|
+
> * {
|
|
35
51
|
border-radius: ${({ stack }) => (!stack ? undefined : 0)};
|
|
36
52
|
}
|
|
53
|
+
`;
|
|
37
54
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
const ReqoreControlGroup = memo(
|
|
56
|
+
forwardRef<HTMLDivElement, IReqoreControlGroupProps>(
|
|
57
|
+
(
|
|
58
|
+
{
|
|
59
|
+
children,
|
|
60
|
+
className,
|
|
61
|
+
minimal,
|
|
62
|
+
size = 'normal',
|
|
63
|
+
gapSize = 'normal',
|
|
64
|
+
fluid,
|
|
65
|
+
flat,
|
|
66
|
+
rounded = true,
|
|
67
|
+
wrap,
|
|
68
|
+
stack,
|
|
69
|
+
isInsideStackGroup,
|
|
70
|
+
isInsideVerticalGroup,
|
|
71
|
+
isFirstInLastGroup,
|
|
72
|
+
isLastInFirstGroup,
|
|
73
|
+
isLastInLastGroup,
|
|
74
|
+
intent,
|
|
75
|
+
isFirst,
|
|
76
|
+
isLast,
|
|
77
|
+
vertical,
|
|
78
|
+
...rest
|
|
79
|
+
}: IReqoreControlGroupProps,
|
|
80
|
+
ref
|
|
81
|
+
) => {
|
|
82
|
+
const isStack = stack || isInsideStackGroup;
|
|
83
|
+
const isVertical = vertical || isInsideVerticalGroup;
|
|
84
|
+
const realChildCount = useMemo((): number => {
|
|
85
|
+
const count = React.Children.toArray(children).filter((child: any) => child).length;
|
|
86
|
+
|
|
87
|
+
return count < 0 ? 0 : count;
|
|
88
|
+
}, [children]);
|
|
89
|
+
|
|
90
|
+
const getIsFirst = (index: number): boolean => {
|
|
91
|
+
return !isInsideStackGroup ? index === 0 : (isFirst || isFirst !== false) && index === 0;
|
|
92
|
+
};
|
|
93
|
+
const getIsLast = (index: number): boolean => {
|
|
94
|
+
return !isInsideStackGroup
|
|
95
|
+
? index === realChildCount - 1
|
|
96
|
+
: (isLast || isLast !== false) && index === realChildCount - 1;
|
|
97
|
+
};
|
|
98
|
+
const getIsLastInFirstGroup = (index: number): boolean => {
|
|
99
|
+
return !isInsideStackGroup
|
|
100
|
+
? index === 0
|
|
101
|
+
: (isFirst || isFirst !== false) && index === realChildCount - 1;
|
|
102
|
+
};
|
|
103
|
+
const getIsFirstInLastGroup = (index: number): boolean => {
|
|
104
|
+
return !isInsideStackGroup
|
|
105
|
+
? index === realChildCount - 1
|
|
106
|
+
: (isLast || isLast !== false) && index === 0;
|
|
107
|
+
};
|
|
108
|
+
const getIsLastInLastGroup = (index: number): boolean => {
|
|
109
|
+
return !isInsideStackGroup
|
|
110
|
+
? index === realChildCount - 1
|
|
111
|
+
: (isLast || isLast !== false) && index === realChildCount - 1;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const getBorderTopLeftRadius = (index: number): number | undefined => {
|
|
115
|
+
// IF this group does not stack
|
|
116
|
+
if (!isStack) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
// If this is the first item
|
|
120
|
+
if (getIsFirst(index)) {
|
|
121
|
+
return RADIUS_FROM_SIZE[size];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return undefined;
|
|
125
|
+
};
|
|
68
126
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
127
|
+
const getBorderTopRightRadius = (index: number): number | undefined => {
|
|
128
|
+
// IF this group does not stack
|
|
129
|
+
if (!isStack) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// If this group is not vertical we need to style the very last item
|
|
134
|
+
if (!isVertical) {
|
|
135
|
+
if (getIsLast(index)) {
|
|
136
|
+
return RADIUS_FROM_SIZE[size];
|
|
73
137
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
border-top-right-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
98
|
-
border-bottom-right-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
99
|
-
}
|
|
100
|
-
`
|
|
101
|
-
: undefined}
|
|
138
|
+
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// This border only needs to apply when this group is vertical
|
|
143
|
+
// AND this item is the last item of the first group
|
|
144
|
+
if (getIsLastInFirstGroup(index)) {
|
|
145
|
+
return RADIUS_FROM_SIZE[size];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return undefined;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const getBorderBottomLeftRadius = (index: number): number | undefined => {
|
|
152
|
+
// IF this group does not stack
|
|
153
|
+
if (!isStack) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// If this group is not vertical we need to style the very first item
|
|
158
|
+
if (!isVertical) {
|
|
159
|
+
if (getIsFirst(index)) {
|
|
160
|
+
return RADIUS_FROM_SIZE[size];
|
|
102
161
|
}
|
|
103
|
-
`}
|
|
104
|
-
`;
|
|
105
162
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// This border only needs to apply when this group is vertical
|
|
167
|
+
// AND this item is the first item of the last group
|
|
168
|
+
if (getIsFirstInLastGroup(index)) {
|
|
169
|
+
return RADIUS_FROM_SIZE[size];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return undefined;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const getBorderBottomRightRadius = (index: number): number | undefined => {
|
|
176
|
+
// IF this group does not stack
|
|
177
|
+
if (!isStack) {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// If this is the last item
|
|
182
|
+
if (getIsLast(index)) {
|
|
183
|
+
return RADIUS_FROM_SIZE[size];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return undefined;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
let index = 0;
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<StyledReqoreControlGroup
|
|
193
|
+
{...rest}
|
|
194
|
+
vertical={vertical}
|
|
195
|
+
size={size}
|
|
196
|
+
gapSize={gapSize}
|
|
197
|
+
ref={ref}
|
|
198
|
+
rounded={rounded}
|
|
199
|
+
fluid={fluid}
|
|
200
|
+
wrap={wrap}
|
|
201
|
+
stack={isStack}
|
|
202
|
+
className={`${className || ''} reqore-control-group`}
|
|
203
|
+
>
|
|
204
|
+
{React.Children.map(children, (child) => {
|
|
205
|
+
/*
|
|
206
|
+
* Because of the way React.Children.map works, we have to
|
|
207
|
+
* manually decrement the index for every child that is `null`
|
|
208
|
+
* because react maps through null children and returns them in `Count`
|
|
209
|
+
* We filter these children out in the `realChildCount` variable,
|
|
210
|
+
* but the index is still incremented
|
|
211
|
+
* */
|
|
212
|
+
const result = child
|
|
213
|
+
? React.cloneElement(child, {
|
|
214
|
+
key: index,
|
|
215
|
+
minimal:
|
|
216
|
+
child.props?.minimal || child.props?.minimal === false
|
|
217
|
+
? child.props.minimal
|
|
218
|
+
: minimal,
|
|
219
|
+
size: child.props?.size || size,
|
|
220
|
+
flat: child.props?.flat || child.props?.flat === false ? child.props.flat : flat,
|
|
221
|
+
fluid:
|
|
222
|
+
child.props?.fluid || child.props?.fluid === false ? child.props.fluid : fluid,
|
|
223
|
+
stack:
|
|
224
|
+
child.props?.stack || child.props?.stack === false
|
|
225
|
+
? child.props.stack
|
|
226
|
+
: isStack,
|
|
227
|
+
intent: child.props?.intent || intent,
|
|
228
|
+
style: {
|
|
229
|
+
borderTopLeftRadius: getBorderTopLeftRadius(index),
|
|
230
|
+
borderBottomLeftRadius: getBorderBottomLeftRadius(index),
|
|
231
|
+
borderTopRightRadius: getBorderTopRightRadius(index),
|
|
232
|
+
borderBottomRightRadius: getBorderBottomRightRadius(index),
|
|
233
|
+
...(child.props?.style || {}),
|
|
234
|
+
},
|
|
235
|
+
rounded: !isStack,
|
|
236
|
+
isInsideStackGroup: isStack,
|
|
237
|
+
isInsideVerticalGroup: isVertical,
|
|
238
|
+
isFirst: getIsFirst(index),
|
|
239
|
+
isLast: getIsLast(index),
|
|
240
|
+
isLastInFirstGroup: getIsLastInFirstGroup(index),
|
|
241
|
+
isLastInLastGroup: getIsLastInLastGroup(index),
|
|
242
|
+
isFirstInLastGroup: getIsFirstInLastGroup(index),
|
|
243
|
+
})
|
|
244
|
+
: null;
|
|
245
|
+
|
|
246
|
+
/*
|
|
247
|
+
* Because of the way React.Children.map works, we have to
|
|
248
|
+
* manually decrement the index for every child that is `null`
|
|
249
|
+
* because react maps through null children and returns them in `Count`
|
|
250
|
+
* We filter these children out in the `realChildCount` variable,
|
|
251
|
+
* but the index is still incremented
|
|
252
|
+
* */
|
|
253
|
+
index = !child ? index : index + 1;
|
|
254
|
+
|
|
255
|
+
return result;
|
|
256
|
+
})}
|
|
257
|
+
</StyledReqoreControlGroup>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
144
260
|
)
|
|
145
261
|
);
|
|
146
262
|
|
|
@@ -98,6 +98,7 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
98
98
|
useTargetWidth={useTargetWidth}
|
|
99
99
|
component={component || ReqoreButton}
|
|
100
100
|
componentProps={componentProps}
|
|
101
|
+
isReqoreComponent
|
|
101
102
|
noWrapper
|
|
102
103
|
placement={placement || 'bottom-start'}
|
|
103
104
|
handler={handler || 'click'}
|
|
@@ -6,14 +6,15 @@ import styled, { css } from 'styled-components';
|
|
|
6
6
|
import { ReqoreThemeContext } from '../..';
|
|
7
7
|
import { ICON_FROM_SIZE, PADDING_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
8
8
|
import { TReqoreIntent } from '../../constants/theme';
|
|
9
|
+
import { getColorFromMaybeString } from '../../helpers/colors';
|
|
9
10
|
import { isStringSize } from '../../helpers/utils';
|
|
10
11
|
import { IWithReqoreEffect } from '../../types/global';
|
|
11
12
|
import { IReqoreIconName } from '../../types/icons';
|
|
12
|
-
import { StyledEffect } from '../Effect';
|
|
13
|
+
import { StyledEffect, TReqoreEffectColor } from '../Effect';
|
|
13
14
|
|
|
14
15
|
export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement>, IWithReqoreEffect {
|
|
15
16
|
icon?: IReqoreIconName;
|
|
16
|
-
color?:
|
|
17
|
+
color?: TReqoreEffectColor;
|
|
17
18
|
size?: TSizes | string;
|
|
18
19
|
iconProps?: IconBaseProps;
|
|
19
20
|
intent?: TReqoreIntent;
|
|
@@ -66,7 +67,9 @@ const ReqoreIcon = memo(
|
|
|
66
67
|
}: IReqoreIconProps) => {
|
|
67
68
|
const theme = useContext(ReqoreThemeContext);
|
|
68
69
|
const Icon: IconType = RemixIcons[`Ri${icon}`];
|
|
69
|
-
const finalColor: string | undefined = intent
|
|
70
|
+
const finalColor: string | undefined = intent
|
|
71
|
+
? theme.intents[intent]
|
|
72
|
+
: getColorFromMaybeString(theme, color);
|
|
70
73
|
const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
|
|
71
74
|
|
|
72
75
|
if (image) {
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
IWithReqoreEffect,
|
|
23
23
|
} from '../../types/global';
|
|
24
24
|
import { IReqoreIconName } from '../../types/icons';
|
|
25
|
-
import { StyledEffect } from '../Effect';
|
|
25
|
+
import { StyledEffect, TReqoreEffectColor } from '../Effect';
|
|
26
26
|
import ReqoreIcon from '../Icon';
|
|
27
27
|
import ReqoreInputClearButton from '../InputClearButton';
|
|
28
28
|
|
|
@@ -48,6 +48,7 @@ export interface IReqoreInputProps
|
|
|
48
48
|
rounded?: boolean;
|
|
49
49
|
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url';
|
|
50
50
|
wrapperStyle?: React.CSSProperties;
|
|
51
|
+
iconColor?: TReqoreEffectColor;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
@@ -150,6 +151,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
150
151
|
className,
|
|
151
152
|
onClearClick,
|
|
152
153
|
icon,
|
|
154
|
+
iconColor,
|
|
153
155
|
flat,
|
|
154
156
|
rounded = true,
|
|
155
157
|
minimal,
|
|
@@ -185,7 +187,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
185
187
|
>
|
|
186
188
|
{icon && (
|
|
187
189
|
<StyledIconWrapper _size={size}>
|
|
188
|
-
<ReqoreIcon size={size} icon={icon} />
|
|
190
|
+
<ReqoreIcon size={size} icon={icon} color={iconColor} />
|
|
189
191
|
</StyledIconWrapper>
|
|
190
192
|
)}
|
|
191
193
|
<StyledInput
|
|
@@ -62,8 +62,8 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
|
62
62
|
max-height: ${({ maxHeight = '80vh' }) => maxHeight};
|
|
63
63
|
z-index: 999999;
|
|
64
64
|
border-radius: ${RADIUS_FROM_SIZE.normal}px;
|
|
65
|
-
border: ${({ flat,
|
|
66
|
-
!flat &&
|
|
65
|
+
border: ${({ flat, noWrapper, ...rest }: any) =>
|
|
66
|
+
!flat && noWrapper ? `1px solid ${getPopoverArrowColor({ ...rest, flat })}` : undefined};
|
|
67
67
|
|
|
68
68
|
${({ transparent }) =>
|
|
69
69
|
!transparent &&
|
|
@@ -129,7 +129,7 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
|
129
129
|
}
|
|
130
130
|
`;
|
|
131
131
|
|
|
132
|
-
const StyledPopoverContent = styled.div
|
|
132
|
+
const StyledPopoverContent = styled.div`
|
|
133
133
|
width: 100%;
|
|
134
134
|
height: 100%;
|
|
135
135
|
z-index: 20;
|
|
@@ -145,6 +145,7 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
145
145
|
id,
|
|
146
146
|
placement,
|
|
147
147
|
noArrow,
|
|
148
|
+
noWrapper,
|
|
148
149
|
useTargetWidth,
|
|
149
150
|
transparent,
|
|
150
151
|
maxWidth,
|
|
@@ -219,7 +220,7 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
219
220
|
isOpaque={!transparent && !minimal}
|
|
220
221
|
intent={intent}
|
|
221
222
|
flat={flat}
|
|
222
|
-
|
|
223
|
+
noWrapper={noWrapper}
|
|
223
224
|
dim={flat && !transparent && !effect && minimal}
|
|
224
225
|
className='reqore-popover-content'
|
|
225
226
|
ref={(el) => {
|
|
@@ -236,8 +237,8 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
236
237
|
{!noArrow && !transparent ? (
|
|
237
238
|
<StyledPopoverArrow ref={setArrowElement} style={styles.arrow} data-popper-arrow />
|
|
238
239
|
) : null}
|
|
239
|
-
<StyledPopoverContent
|
|
240
|
-
{isString(content) ? (
|
|
240
|
+
<StyledPopoverContent>
|
|
241
|
+
{!noWrapper || isString(content) ? (
|
|
241
242
|
<ReqoreMessage
|
|
242
243
|
opaque={!transparent && !minimal}
|
|
243
244
|
className='reqore-popover-text'
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
IWithReqoreSize,
|
|
15
15
|
} from '../../types/global';
|
|
16
16
|
import { IReqoreIconName } from '../../types/icons';
|
|
17
|
+
import { TReqoreEffectColor } from '../Effect';
|
|
17
18
|
import { ReqoreHeading } from '../Header';
|
|
18
19
|
import ReqoreIcon from '../Icon';
|
|
19
20
|
import {
|
|
@@ -35,6 +36,7 @@ export interface IReqoreMessageProps
|
|
|
35
36
|
title?: string;
|
|
36
37
|
children: any;
|
|
37
38
|
icon?: IReqoreIconName;
|
|
39
|
+
iconColor?: TReqoreEffectColor;
|
|
38
40
|
onClose?: () => any;
|
|
39
41
|
onClick?: () => any;
|
|
40
42
|
duration?: number;
|
|
@@ -64,6 +66,7 @@ const ReqoreMessage = forwardRef<HTMLDivElement, IReqoreMessageProps>(
|
|
|
64
66
|
minimal,
|
|
65
67
|
size = 'normal',
|
|
66
68
|
customTheme,
|
|
69
|
+
iconColor,
|
|
67
70
|
...rest
|
|
68
71
|
},
|
|
69
72
|
ref: any
|
|
@@ -128,7 +131,12 @@ const ReqoreMessage = forwardRef<HTMLDivElement, IReqoreMessageProps>(
|
|
|
128
131
|
>
|
|
129
132
|
{leftIcon ? (
|
|
130
133
|
<StyledIconWrapper intent={intent} size={size} theme={theme}>
|
|
131
|
-
<ReqoreIcon
|
|
134
|
+
<ReqoreIcon
|
|
135
|
+
icon={leftIcon}
|
|
136
|
+
margin={flat && minimal ? 'right' : 'both'}
|
|
137
|
+
size={size}
|
|
138
|
+
color={iconColor}
|
|
139
|
+
/>
|
|
132
140
|
</StyledIconWrapper>
|
|
133
141
|
) : null}
|
|
134
142
|
<StyledNotificationContentWrapper size={size} theme={theme}>
|
|
@@ -87,6 +87,7 @@ export interface IReqorePanelProps
|
|
|
87
87
|
contentEffect?: IReqoreEffect;
|
|
88
88
|
headerEffect?: IReqoreEffect;
|
|
89
89
|
transparent?: boolean;
|
|
90
|
+
iconColor?: TReqoreEffectColor;
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
export interface IStyledPanel extends IReqorePanelProps {
|
|
@@ -266,6 +267,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
266
267
|
minimal,
|
|
267
268
|
tooltip,
|
|
268
269
|
badge,
|
|
270
|
+
iconColor,
|
|
269
271
|
...rest
|
|
270
272
|
}: IReqorePanelProps,
|
|
271
273
|
ref
|
|
@@ -455,6 +457,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
455
457
|
size={`${ICON_FROM_HEADER_SIZE[headerSize]}px`}
|
|
456
458
|
icon={icon}
|
|
457
459
|
margin='right'
|
|
460
|
+
color={iconColor}
|
|
458
461
|
/>
|
|
459
462
|
)}
|
|
460
463
|
{typeof label === 'string' ? (
|
|
@@ -8,7 +8,6 @@ export interface IReqorePopoverProps extends IReqoreComponent, IPopoverOptions {
|
|
|
8
8
|
componentProps?: any;
|
|
9
9
|
children?: any;
|
|
10
10
|
isReqoreComponent?: boolean;
|
|
11
|
-
noWrapper?: boolean;
|
|
12
11
|
wrapperTag?: string;
|
|
13
12
|
wrapperStyle?: React.CSSProperties;
|
|
14
13
|
}
|
|
@@ -23,7 +22,6 @@ const Popover = memo(
|
|
|
23
22
|
componentProps,
|
|
24
23
|
children,
|
|
25
24
|
isReqoreComponent,
|
|
26
|
-
noWrapper,
|
|
27
25
|
wrapperTag = 'span',
|
|
28
26
|
wrapperStyle = {},
|
|
29
27
|
passPopoverData,
|
|
@@ -39,7 +37,7 @@ const Popover = memo(
|
|
|
39
37
|
passPopoverData?.(popoverData);
|
|
40
38
|
}, [popoverData]);
|
|
41
39
|
|
|
42
|
-
if (isReqoreComponent
|
|
40
|
+
if (isReqoreComponent) {
|
|
43
41
|
return (
|
|
44
42
|
<Component
|
|
45
43
|
{...componentProps}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import { firstBy } from
|
|
2
|
-
import { IReqoreTableSort } from
|
|
1
|
+
import { firstBy } from 'thenby';
|
|
2
|
+
import { IReqoreTableSort } from '.';
|
|
3
3
|
|
|
4
|
-
export const flipSortDirection = (direction:
|
|
5
|
-
direction ===
|
|
4
|
+
export const flipSortDirection = (direction: 'asc' | 'desc'): 'asc' | 'desc' =>
|
|
5
|
+
direction === 'asc' ? 'desc' : 'asc';
|
|
6
6
|
|
|
7
7
|
export const fixSort = (sort?: IReqoreTableSort) => {
|
|
8
|
-
return { ...(sort || {}), direction: sort?.direction ||
|
|
8
|
+
return { ...(sort || {}), direction: sort?.direction || 'desc' };
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const sortTableData = (data: any[], sort: IReqoreTableSort) => {
|
|
12
|
-
const { by, direction } = sort;
|
|
12
|
+
const { by, thenBy, direction } = sort;
|
|
13
13
|
|
|
14
14
|
if (!by) {
|
|
15
15
|
return data;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
if (thenBy) {
|
|
19
|
+
return [...data].sort(
|
|
20
|
+
firstBy(by, { ignoreCase: true, direction }).thenBy(thenBy, { ignoreCase: true, direction })
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
return [...data].sort(firstBy(by, { ignoreCase: true, direction }));
|
|
19
25
|
};
|
|
@@ -45,8 +45,8 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
|
45
45
|
border-right: 0;
|
|
46
46
|
}
|
|
47
47
|
${StyledButton}:last-child {
|
|
48
|
-
border-top-right-radius: 0;
|
|
49
|
-
border-bottom-right-radius: 0;
|
|
48
|
+
border-top-right-radius: 0 !important;
|
|
49
|
+
border-bottom-right-radius: 0 !important;
|
|
50
50
|
}
|
|
51
51
|
`
|
|
52
52
|
: css`
|
|
@@ -54,10 +54,10 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
|
54
54
|
border-bottom: 0;
|
|
55
55
|
}
|
|
56
56
|
${StyledButton}:first-child {
|
|
57
|
-
border-bottom-left-radius: 0;
|
|
57
|
+
border-bottom-left-radius: 0 !important;
|
|
58
58
|
}
|
|
59
59
|
${StyledButton}:last-child {
|
|
60
|
-
border-bottom-right-radius: 0;
|
|
60
|
+
border-bottom-right-radius: 0 !important;
|
|
61
61
|
}
|
|
62
62
|
`}
|
|
63
63
|
|