@qoretechnologies/reqore 0.29.4 → 0.29.6
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/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +6 -3
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +4 -1
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +28 -3
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +1 -1
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +15 -3
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +146 -43
- package/dist/components/ControlGroup/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 +7 -4
- package/dist/components/Input/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/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/index.d.ts +3 -0
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +9 -9
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +0 -1
- package/dist/components/Textarea/index.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 -2
- package/src/components/Collection/index.tsx +35 -4
- package/src/components/Collection/item.tsx +1 -1
- package/src/components/ControlGroup/index.tsx +252 -103
- package/src/components/Icon/index.tsx +6 -3
- package/src/components/Input/index.tsx +7 -3
- package/src/components/Message/index.tsx +9 -1
- package/src/components/Panel/index.tsx +3 -0
- 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/index.tsx +34 -11
- package/src/components/Textarea/index.tsx +0 -2
- package/src/mock/collectionData.tsx +3 -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 +16 -1
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +119 -35
- 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 +1 -0
- package/src/stories/Message/Message.stories.tsx +7 -0
- package/src/stories/Panel/Panel.stories.tsx +1 -0
- package/src/stories/Tabs/Tabs.stories.tsx +2 -1
- package/src/stories/Tag/Tag.stories.tsx +8 -0
- package/src/stories/TextArea/TextArea.stories.tsx +1 -1
- 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;
|
|
@@ -19,6 +25,18 @@ export interface IReqoreControlGroupProps
|
|
|
19
25
|
*/
|
|
20
26
|
vertical?: boolean;
|
|
21
27
|
wrap?: boolean;
|
|
28
|
+
isInsideStackGroup?: boolean;
|
|
29
|
+
isInsideVerticalGroup?: boolean;
|
|
30
|
+
isFirst?: boolean;
|
|
31
|
+
isLast?: boolean;
|
|
32
|
+
isLastInFirstGroup?: boolean;
|
|
33
|
+
isLastInLastGroup?: boolean;
|
|
34
|
+
isFirstInLastGroup?: boolean;
|
|
35
|
+
childrenCount?: number;
|
|
36
|
+
childId?: number;
|
|
37
|
+
isChild?: boolean;
|
|
38
|
+
isFirstGroup?: boolean;
|
|
39
|
+
isLastGroup?: boolean;
|
|
22
40
|
}
|
|
23
41
|
|
|
24
42
|
export interface IReqoreControlGroupStyle extends IReqoreControlGroupProps {
|
|
@@ -34,112 +52,243 @@ export const StyledReqoreControlGroup = styled.div<IReqoreControlGroupStyle>`
|
|
|
34
52
|
gap: ${({ gapSize, stack }) => (!stack ? `${GAP_FROM_SIZE[gapSize]}px` : undefined)};
|
|
35
53
|
flex-wrap: ${({ wrap }) => (wrap ? 'wrap' : 'nowrap')};
|
|
36
54
|
|
|
37
|
-
>
|
|
55
|
+
> * {
|
|
38
56
|
border-radius: ${({ stack }) => (!stack ? undefined : 0)};
|
|
39
57
|
}
|
|
58
|
+
`;
|
|
40
59
|
|
|
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
|
-
|
|
68
|
-
|
|
60
|
+
const ReqoreControlGroup = memo(
|
|
61
|
+
forwardRef<HTMLDivElement, IReqoreControlGroupProps>(
|
|
62
|
+
(
|
|
63
|
+
{
|
|
64
|
+
children,
|
|
65
|
+
className,
|
|
66
|
+
minimal,
|
|
67
|
+
size = 'normal',
|
|
68
|
+
gapSize = 'normal',
|
|
69
|
+
fluid,
|
|
70
|
+
flat,
|
|
71
|
+
rounded = true,
|
|
72
|
+
wrap,
|
|
73
|
+
stack,
|
|
74
|
+
isInsideStackGroup,
|
|
75
|
+
isInsideVerticalGroup,
|
|
76
|
+
isFirstInLastGroup,
|
|
77
|
+
isLastInFirstGroup,
|
|
78
|
+
isLastInLastGroup,
|
|
79
|
+
intent,
|
|
80
|
+
isFirst,
|
|
81
|
+
isLast,
|
|
82
|
+
vertical,
|
|
83
|
+
childrenCount,
|
|
84
|
+
childId,
|
|
85
|
+
isChild,
|
|
86
|
+
isFirstGroup,
|
|
87
|
+
isLastGroup,
|
|
88
|
+
...rest
|
|
89
|
+
}: IReqoreControlGroupProps,
|
|
90
|
+
ref
|
|
91
|
+
) => {
|
|
92
|
+
const isStack = stack || isInsideStackGroup;
|
|
93
|
+
const isVertical = vertical || isInsideVerticalGroup;
|
|
94
|
+
const realChildCount = useMemo((): number => {
|
|
95
|
+
const count = React.Children.toArray(children).filter((child: any) => child).length;
|
|
96
|
+
|
|
97
|
+
return count < 0 ? 0 : count;
|
|
98
|
+
}, [children]);
|
|
99
|
+
|
|
100
|
+
const getIsFirst = (index: number): boolean => {
|
|
101
|
+
return !isInsideStackGroup || childrenCount === 1
|
|
102
|
+
? index === 0
|
|
103
|
+
: (isFirst || isFirst !== false) && index === 0;
|
|
104
|
+
};
|
|
105
|
+
const getIsLast = (index: number): boolean => {
|
|
106
|
+
return !isInsideStackGroup
|
|
107
|
+
? index === realChildCount - 1
|
|
108
|
+
: (isLast || isLast !== false) && index === realChildCount - 1;
|
|
109
|
+
};
|
|
110
|
+
const getIsLastInFirstGroup = (index: number): boolean => {
|
|
111
|
+
return !isInsideStackGroup
|
|
112
|
+
? index === 0
|
|
113
|
+
: isFirstGroup && (isLast || isLast !== false) && index === realChildCount - 1;
|
|
114
|
+
};
|
|
115
|
+
const getIsFirstInLastGroup = (index: number): boolean => {
|
|
116
|
+
return !isInsideStackGroup
|
|
117
|
+
? index === realChildCount - 1
|
|
118
|
+
: isLastGroup && (isFirst || isFirst !== false) && childId === 1 && index === 0;
|
|
119
|
+
};
|
|
120
|
+
const getIsLastInLastGroup = (index: number): boolean => {
|
|
121
|
+
return !isInsideStackGroup
|
|
122
|
+
? index === realChildCount - 1
|
|
123
|
+
: isLastGroup && (isLast || isLast !== false) && index === realChildCount - 1;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const getBorderTopLeftRadius = (index: number): number | undefined => {
|
|
127
|
+
const _isFirstGroup =
|
|
128
|
+
!isInsideStackGroup || childrenCount === 1 ? true : isChild ? isFirstGroup : index === 0;
|
|
129
|
+
|
|
130
|
+
// If this is the first item
|
|
131
|
+
if (_isFirstGroup && getIsFirst(index)) {
|
|
132
|
+
return RADIUS_FROM_SIZE[size];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return undefined;
|
|
136
|
+
};
|
|
69
137
|
|
|
70
|
-
|
|
71
|
-
|
|
138
|
+
const getBorderTopRightRadius = (index: number): number | undefined => {
|
|
139
|
+
// If this group is not vertical we need to style the very last item
|
|
140
|
+
if (!isVertical || !isStack) {
|
|
141
|
+
const _isLastGroup =
|
|
142
|
+
!isInsideStackGroup || childrenCount === 1
|
|
143
|
+
? true
|
|
144
|
+
: isChild
|
|
145
|
+
? isLastGroup
|
|
146
|
+
: index === realChildCount - 1;
|
|
147
|
+
|
|
148
|
+
if (_isLastGroup && getIsLast(index)) {
|
|
149
|
+
return RADIUS_FROM_SIZE[size];
|
|
72
150
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
: undefined}
|
|
151
|
+
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// This border only needs to apply when this group is vertical
|
|
156
|
+
// AND this item is the last item of the first group
|
|
157
|
+
if (getIsLastInFirstGroup(index)) {
|
|
158
|
+
return RADIUS_FROM_SIZE[size];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return undefined;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const getBorderBottomLeftRadius = (index: number): number | undefined => {
|
|
165
|
+
// If this group is not vertical we need to style the very first item
|
|
166
|
+
if (!isVertical || !isStack) {
|
|
167
|
+
const _isFirstGroup =
|
|
168
|
+
!isInsideStackGroup || childrenCount === 1
|
|
169
|
+
? true
|
|
170
|
+
: isChild
|
|
171
|
+
? isFirstGroup
|
|
172
|
+
: index === 0;
|
|
173
|
+
|
|
174
|
+
if (_isFirstGroup && getIsFirst(index)) {
|
|
175
|
+
return RADIUS_FROM_SIZE[size];
|
|
99
176
|
}
|
|
100
|
-
`}
|
|
101
|
-
`;
|
|
102
177
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// This border only needs to apply when this group is vertical
|
|
182
|
+
// AND this item is the first item of the last group
|
|
183
|
+
if (getIsFirstInLastGroup(index)) {
|
|
184
|
+
return RADIUS_FROM_SIZE[size];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return undefined;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const getBorderBottomRightRadius = (index: number): number | undefined => {
|
|
191
|
+
const _isLastGroup =
|
|
192
|
+
!isInsideStackGroup || childrenCount === 1
|
|
193
|
+
? true
|
|
194
|
+
: isChild
|
|
195
|
+
? isLastGroup
|
|
196
|
+
: index === realChildCount - 1;
|
|
197
|
+
|
|
198
|
+
// If this is the last item
|
|
199
|
+
if (_isLastGroup && getIsLast(index)) {
|
|
200
|
+
return RADIUS_FROM_SIZE[size];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return undefined;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
let index = 0;
|
|
207
|
+
|
|
208
|
+
const getStuff = (index, child) => {
|
|
209
|
+
if (isStack) {
|
|
210
|
+
return {
|
|
211
|
+
style: {
|
|
212
|
+
borderTopLeftRadius: getBorderTopLeftRadius(index),
|
|
213
|
+
borderBottomLeftRadius: getBorderBottomLeftRadius(index),
|
|
214
|
+
borderTopRightRadius: getBorderTopRightRadius(index),
|
|
215
|
+
borderBottomRightRadius: getBorderBottomRightRadius(index),
|
|
216
|
+
...(child.props?.style || {}),
|
|
217
|
+
},
|
|
218
|
+
rounded: !isStack,
|
|
219
|
+
isInsideStackGroup: isStack,
|
|
220
|
+
isInsideVerticalGroup: isVertical,
|
|
221
|
+
isFirst: isChild ? getIsFirst(index) : undefined,
|
|
222
|
+
isLast: isChild ? getIsLast(index) : undefined,
|
|
223
|
+
isLastInFirstGroup: getIsLastInFirstGroup(index),
|
|
224
|
+
isLastInLastGroup: getIsLastInLastGroup(index),
|
|
225
|
+
isFirstInLastGroup: getIsFirstInLastGroup(index),
|
|
226
|
+
childrenCount: realChildCount,
|
|
227
|
+
childId: index + 1,
|
|
228
|
+
isChild: true,
|
|
229
|
+
isFirstGroup: isChild ? isFirstGroup : index === 0,
|
|
230
|
+
isLastGroup: isChild ? isLastGroup : index === realChildCount - 1,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return {};
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
<StyledReqoreControlGroup
|
|
239
|
+
{...rest}
|
|
240
|
+
vertical={vertical}
|
|
241
|
+
size={size}
|
|
242
|
+
gapSize={gapSize}
|
|
243
|
+
ref={ref}
|
|
244
|
+
rounded={rounded}
|
|
245
|
+
fluid={fluid}
|
|
246
|
+
wrap={wrap}
|
|
247
|
+
stack={isStack}
|
|
248
|
+
className={`${className || ''} reqore-control-group`}
|
|
249
|
+
>
|
|
250
|
+
{React.Children.map(children, (child) => {
|
|
251
|
+
/*
|
|
252
|
+
* Because of the way React.Children.map works, we have to
|
|
253
|
+
* manually decrement the index for every child that is `null`
|
|
254
|
+
* because react maps through null children and returns them in `Count`
|
|
255
|
+
* We filter these children out in the `realChildCount` variable,
|
|
256
|
+
* but the index is still incremented
|
|
257
|
+
* */
|
|
258
|
+
const result = child
|
|
259
|
+
? React.cloneElement(child, {
|
|
260
|
+
key: index,
|
|
261
|
+
minimal:
|
|
262
|
+
child.props?.minimal || child.props?.minimal === false
|
|
263
|
+
? child.props.minimal
|
|
264
|
+
: minimal,
|
|
265
|
+
size: child.props?.size || size,
|
|
266
|
+
flat: child.props?.flat || child.props?.flat === false ? child.props.flat : flat,
|
|
267
|
+
fluid:
|
|
268
|
+
child.props?.fluid || child.props?.fluid === false ? child.props.fluid : fluid,
|
|
269
|
+
stack:
|
|
270
|
+
child.props?.stack || child.props?.stack === false
|
|
271
|
+
? child.props.stack
|
|
272
|
+
: isStack,
|
|
273
|
+
intent: child.props?.intent || intent,
|
|
274
|
+
...getStuff(index, child),
|
|
275
|
+
})
|
|
276
|
+
: null;
|
|
277
|
+
|
|
278
|
+
/*
|
|
279
|
+
* Because of the way React.Children.map works, we have to
|
|
280
|
+
* manually decrement the index for every child that is `null`
|
|
281
|
+
* because react maps through null children and returns them in `Count`
|
|
282
|
+
* We filter these children out in the `realChildCount` variable,
|
|
283
|
+
* but the index is still incremented
|
|
284
|
+
* */
|
|
285
|
+
index = !child ? index : index + 1;
|
|
286
|
+
|
|
287
|
+
return result;
|
|
288
|
+
})}
|
|
289
|
+
</StyledReqoreControlGroup>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
143
292
|
)
|
|
144
293
|
);
|
|
145
294
|
|
|
@@ -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 {
|
|
@@ -60,7 +61,9 @@ export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
|
60
61
|
export const StyledInputWrapper = styled.div<IReqoreInputStyle>`
|
|
61
62
|
height: ${({ _size }) => SIZE_TO_PX[_size]}px;
|
|
62
63
|
width: ${({ width }) => (width ? `${width}px` : 'auto')};
|
|
63
|
-
|
|
64
|
+
max-width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
65
|
+
min-width: 60px;
|
|
66
|
+
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 1 auto')};
|
|
64
67
|
font-size: ${({ _size }) => TEXT_FROM_SIZE[_size]}px;
|
|
65
68
|
position: relative;
|
|
66
69
|
overflow: hidden;
|
|
@@ -150,6 +153,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
150
153
|
className,
|
|
151
154
|
onClearClick,
|
|
152
155
|
icon,
|
|
156
|
+
iconColor,
|
|
153
157
|
flat,
|
|
154
158
|
rounded = true,
|
|
155
159
|
minimal,
|
|
@@ -185,7 +189,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
185
189
|
>
|
|
186
190
|
{icon && (
|
|
187
191
|
<StyledIconWrapper _size={size}>
|
|
188
|
-
<ReqoreIcon size={size} icon={icon} />
|
|
192
|
+
<ReqoreIcon size={size} icon={icon} color={iconColor} />
|
|
189
193
|
</StyledIconWrapper>
|
|
190
194
|
)}
|
|
191
195
|
<StyledInput
|
|
@@ -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' ? (
|
|
@@ -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
|
|