@qoretechnologies/reqore 0.30.5 → 0.30.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/CODE_OF_CONDUCT.md +105 -0
- package/CONTRIBUTING.MD +78 -0
- package/LICENSE +1 -1
- package/README.md +44 -2
- package/SECURITY.md +5 -0
- package/__tests__/collection.test.tsx +1 -1
- package/__tests__/{control_group.test.tsx → control_group.text.tsx} +2 -4
- package/__tests__/modal.test.tsx +2 -74
- package/__tests__/panel.test.tsx +24 -96
- package/__tests__/popover.test.tsx +2 -24
- package/__tests__/tabs.test.tsx +0 -75
- package/dist/components/Button/index.d.ts +2 -7
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +20 -30
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +3 -6
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +2 -7
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +53 -57
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +5 -5
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +4 -15
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Columns/column.d.ts.map +1 -1
- package/dist/components/Columns/column.js +1 -1
- package/dist/components/Columns/column.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +4 -21
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +55 -250
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +3 -3
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +16 -27
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +0 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +3 -3
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Effect/index.d.ts +10 -10
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +6 -7
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +6 -5
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +7 -14
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +0 -2
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +4 -10
- 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 +10 -12
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Message/index.d.ts +0 -2
- 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/MultiSelect/index.d.ts +2 -2
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.js +10 -10
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/Notifications/index.d.ts +1 -1
- package/dist/components/Notifications/index.d.ts.map +1 -1
- package/dist/components/Notifications/notification.d.ts +1 -1
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Panel/index.d.ts +6 -13
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +44 -78
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +2 -1
- 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/Spacer/index.d.ts +0 -2
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spacer/index.js +7 -29
- package/dist/components/Spacer/index.js.map +1 -1
- package/dist/components/Table/header.js +2 -2
- package/dist/components/Table/header.js.map +1 -1
- package/dist/components/Table/headerCell.js +2 -2
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/helpers.d.ts +2 -3
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +3 -6
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +3 -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 +5 -0
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +7 -3
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tabs/content.d.ts +1 -3
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/content.js +3 -8
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +1 -4
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +4 -12
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +0 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +7 -7
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +6 -7
- 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 +8 -7
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.d.ts +2 -6
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +12 -24
- 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/constants/animations.js +1 -1
- package/dist/constants/sizes.d.ts +2 -2
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +10 -10
- package/dist/constants/sizes.js.map +1 -1
- package/dist/constants/theme.d.ts +1 -1
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.js +8 -10
- package/dist/containers/PopoverProvider.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +2 -4
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +0 -7
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +0 -2
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +2 -6
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/utils.d.ts +0 -3
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +2 -17
- package/dist/helpers/utils.js.map +1 -1
- package/dist/hooks/useLatestZIndex.js +2 -2
- package/dist/hooks/useLatestZIndex.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +0 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +6 -8
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/styles.d.ts +0 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +5 -6
- package/dist/styles.js.map +1 -1
- package/dist/types/global.d.ts +1 -27
- package/dist/types/global.d.ts.map +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.d.ts.map +1 -1
- package/package.json +1 -1
- package/public/logo-dark.png +0 -0
- package/public/logo.png +0 -0
- package/public/q-symbol.png +0 -0
- package/public/qoreLogo-dark.png +0 -0
- package/public/qoreLogo.png +0 -0
- package/src/components/Button/index.tsx +34 -79
- package/src/components/Checkbox/index.tsx +2 -3
- package/src/components/Collection/index.tsx +60 -93
- package/src/components/Collection/item.tsx +9 -29
- package/src/components/Columns/column.tsx +0 -1
- package/src/components/ControlGroup/index.tsx +104 -449
- package/src/components/Drawer/index.tsx +27 -28
- package/src/components/Dropdown/index.tsx +1 -3
- package/src/components/Effect/index.tsx +14 -22
- package/src/components/Icon/index.tsx +62 -81
- package/src/components/Input/index.tsx +3 -8
- package/src/components/InternalPopover/index.tsx +126 -131
- package/src/components/Menu/index.tsx +1 -7
- package/src/components/Message/index.tsx +1 -9
- package/src/components/MultiSelect/index.tsx +188 -180
- package/src/components/Panel/index.tsx +100 -227
- package/src/components/Popover/index.tsx +3 -1
- package/src/components/Spacer/index.tsx +14 -63
- package/src/components/Table/header.tsx +2 -2
- package/src/components/Table/headerCell.tsx +2 -2
- package/src/components/Table/helpers.ts +6 -12
- package/src/components/Table/index.tsx +0 -1
- package/src/components/Table/row.tsx +7 -2
- package/src/components/Tabs/content.tsx +3 -11
- package/src/components/Tabs/index.tsx +3 -14
- package/src/components/Tabs/item.tsx +5 -28
- package/src/components/Tabs/list.tsx +3 -7
- package/src/components/Tag/group.tsx +12 -6
- package/src/components/Tag/index.tsx +35 -69
- package/src/components/Tree/index.tsx +1 -1
- package/src/constants/animations.ts +1 -1
- package/src/constants/sizes.ts +10 -10
- package/src/containers/PopoverProvider.tsx +8 -11
- package/src/containers/ReqoreProvider.tsx +35 -40
- package/src/containers/UIProvider.tsx +0 -7
- package/src/context/ReqoreContext.tsx +0 -2
- package/src/helpers/colors.ts +2 -8
- package/src/helpers/utils.ts +0 -18
- package/src/hooks/useLatestZIndex.ts +2 -2
- package/src/hooks/usePopover.tsx +6 -9
- package/src/mock/collectionData.tsx +2 -33
- package/src/stories/Button/Button.stories.tsx +7 -72
- package/src/stories/Checkbox/Checkbox.stories.tsx +3 -6
- package/src/stories/Collection/Collection.stories.tsx +2 -18
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +33 -282
- package/src/stories/Drawer/Drawer.stories.tsx +3 -70
- package/src/stories/Dropdown/Dropdown.stories.tsx +3 -13
- package/src/stories/Icon/Icon.stories.tsx +0 -1
- package/src/stories/Input/Input.stories.tsx +3 -5
- package/src/stories/Menu/Menu.stories.tsx +0 -2
- package/src/stories/Message/Message.stories.tsx +0 -7
- package/src/stories/Panel/Panel.stories.tsx +13 -147
- package/src/stories/Popover/Popover.stories.tsx +82 -88
- package/src/stories/Tabs/Tabs.stories.tsx +15 -33
- package/src/stories/Tag/Tag.stories.tsx +3 -23
- package/src/stories/TextArea/TextArea.stories.tsx +3 -3
- package/src/styles.ts +0 -6
- package/src/types/global.ts +0 -28
- package/tests.json +1 -1
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { IReqoreCustomTheme, IReqoreTheme } from '../../constants/theme';
|
|
12
12
|
import ReqoreContext from '../../context/ReqoreContext';
|
|
13
13
|
import { changeLightness, getReadableColor, getReadableColorFrom } from '../../helpers/colors';
|
|
14
|
-
import {
|
|
14
|
+
import { getOneLessSize } from '../../helpers/utils';
|
|
15
15
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
16
16
|
import { useReqoreEffect } from '../../hooks/useReqoreEffect';
|
|
17
17
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
} from '../../types/global';
|
|
34
34
|
import { IReqoreIconName } from '../../types/icons';
|
|
35
35
|
import {
|
|
36
|
-
IReqoreEffect,
|
|
37
36
|
ReqoreTextEffect,
|
|
38
37
|
StyledEffect,
|
|
39
38
|
StyledTextEffect,
|
|
@@ -68,11 +67,6 @@ export interface IReqoreButtonProps
|
|
|
68
67
|
description?: string | number;
|
|
69
68
|
maxWidth?: string;
|
|
70
69
|
textAlign?: 'left' | 'center' | 'right';
|
|
71
|
-
iconColor?: TReqoreEffectColor;
|
|
72
|
-
leftIconColor?: TReqoreEffectColor;
|
|
73
|
-
rightIconColor?: TReqoreEffectColor;
|
|
74
|
-
labelEffect?: IReqoreEffect;
|
|
75
|
-
descriptionEffect?: IReqoreEffect;
|
|
76
70
|
}
|
|
77
71
|
|
|
78
72
|
export interface IReqoreButtonStyle extends Omit<IReqoreButtonProps, 'intent'> {
|
|
@@ -92,13 +86,10 @@ const getButtonMainColor = (theme: IReqoreTheme, color?: TReqoreHexColor) => {
|
|
|
92
86
|
export const StyledAnimatedTextWrapper = styled.span`
|
|
93
87
|
overflow: hidden;
|
|
94
88
|
position: relative;
|
|
95
|
-
text-align:
|
|
96
|
-
display: flex;
|
|
97
|
-
flex-flow: column;
|
|
98
|
-
align-items: ${({ textAlign }) => alignToFlexAlign(textAlign)};
|
|
89
|
+
text-align: left;
|
|
99
90
|
`;
|
|
100
91
|
|
|
101
|
-
export const StyledActiveContent = styled
|
|
92
|
+
export const StyledActiveContent = styled.span`
|
|
102
93
|
position: absolute;
|
|
103
94
|
transform: translateY(-150%);
|
|
104
95
|
opacity: 0;
|
|
@@ -118,7 +109,7 @@ export const StyledActiveContent = styled(StyledTextEffect)`
|
|
|
118
109
|
`}
|
|
119
110
|
`;
|
|
120
111
|
|
|
121
|
-
export const StyledInActiveContent = styled
|
|
112
|
+
export const StyledInActiveContent = styled.span`
|
|
122
113
|
position: absolute;
|
|
123
114
|
transform: translateY(0);
|
|
124
115
|
transition: all 0.2s ease-out;
|
|
@@ -136,7 +127,7 @@ export const StyledInActiveContent = styled(StyledTextEffect)`
|
|
|
136
127
|
`}
|
|
137
128
|
`;
|
|
138
129
|
|
|
139
|
-
export const StyledInvisibleContent = styled
|
|
130
|
+
export const StyledInvisibleContent = styled.span`
|
|
140
131
|
visibility: hidden;
|
|
141
132
|
position: relative;
|
|
142
133
|
overflow: hidden;
|
|
@@ -167,7 +158,7 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
167
158
|
|
|
168
159
|
min-height: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
169
160
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
170
|
-
max-width: ${({ maxWidth
|
|
161
|
+
max-width: ${({ maxWidth }) => maxWidth || undefined};
|
|
171
162
|
${({ wrap, description }) =>
|
|
172
163
|
!wrap && !description
|
|
173
164
|
? css`
|
|
@@ -176,7 +167,6 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
176
167
|
: null}
|
|
177
168
|
|
|
178
169
|
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
179
|
-
align-self: ${({ fixed, fluid }) => (fixed ? 'flex-start' : fluid ? 'stretch' : undefined)};
|
|
180
170
|
|
|
181
171
|
border-radius: ${({ size }) => RADIUS_FROM_SIZE[size]}px;
|
|
182
172
|
|
|
@@ -207,7 +197,7 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
207
197
|
transition: all 0.2s ease-out;
|
|
208
198
|
|
|
209
199
|
&:active {
|
|
210
|
-
transform:
|
|
200
|
+
transform: translateY(2px);
|
|
211
201
|
}
|
|
212
202
|
|
|
213
203
|
&:hover,
|
|
@@ -247,32 +237,24 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
247
237
|
`
|
|
248
238
|
: undefined}
|
|
249
239
|
|
|
250
|
-
${({ active, flat, theme, color }: IReqoreButtonStyle) =>
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
240
|
+
${({ active, flat, theme, color }: IReqoreButtonStyle) =>
|
|
241
|
+
active &&
|
|
242
|
+
css`
|
|
243
|
+
cursor: pointer;
|
|
244
|
+
background-color: ${changeLightness(getButtonMainColor(theme, color), 0.1)};
|
|
245
|
+
color: ${getReadableColor({ main: getButtonMainColor(theme, color) }, undefined, undefined)};
|
|
246
|
+
border-color: ${flat ? undefined : changeLightness(getButtonMainColor(theme, color), 0.175)};
|
|
247
|
+
|
|
248
|
+
&:hover,
|
|
249
|
+
&:active,
|
|
250
|
+
&:focus {
|
|
260
251
|
border-color: ${flat
|
|
261
252
|
? undefined
|
|
262
|
-
: changeLightness(getButtonMainColor(theme, color), 0.
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
border-color: ${flat
|
|
268
|
-
? undefined
|
|
269
|
-
: changeLightness(getButtonMainColor(theme, color), 0.275)};
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
${ActiveIconScale}
|
|
273
|
-
`;
|
|
274
|
-
}
|
|
275
|
-
}}
|
|
253
|
+
: changeLightness(getButtonMainColor(theme, color), 0.275)};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
${ActiveIconScale}
|
|
257
|
+
`}
|
|
276
258
|
|
|
277
259
|
&:disabled {
|
|
278
260
|
${DisabledElement};
|
|
@@ -288,7 +270,7 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
288
270
|
minimal ? undefined : changeLightness(getButtonMainColor(theme, color), 0.4)};
|
|
289
271
|
}
|
|
290
272
|
|
|
291
|
-
|
|
273
|
+
${StyledTextEffect} {
|
|
292
274
|
padding-bottom: ${({ size }) => PADDING_FROM_SIZE[getOneLessSize(size)]}px;
|
|
293
275
|
}
|
|
294
276
|
`;
|
|
@@ -343,7 +325,7 @@ export const ButtonBadge = memo((props: IReqoreButtonBadgeProps) => {
|
|
|
343
325
|
width={props.wrap ? undefined : PADDING_FROM_SIZE[props.size]}
|
|
344
326
|
height={!props.wrap ? undefined : PADDING_FROM_SIZE[props.size] / 2}
|
|
345
327
|
/>
|
|
346
|
-
<ReqoreTagGroup>
|
|
328
|
+
<ReqoreTagGroup hasBottomMargin={false}>
|
|
347
329
|
{props.content.map((badge, index) => renderTag({ ...props, content: badge, key: index }))}
|
|
348
330
|
</ReqoreTagGroup>
|
|
349
331
|
</>
|
|
@@ -385,11 +367,6 @@ const ReqoreButton = memo(
|
|
|
385
367
|
maxWidth,
|
|
386
368
|
textAlign = 'left',
|
|
387
369
|
effect,
|
|
388
|
-
labelEffect,
|
|
389
|
-
descriptionEffect,
|
|
390
|
-
leftIconColor,
|
|
391
|
-
rightIconColor,
|
|
392
|
-
iconColor,
|
|
393
370
|
...rest
|
|
394
371
|
}: IReqoreButtonProps,
|
|
395
372
|
ref
|
|
@@ -414,14 +391,10 @@ const ReqoreButton = memo(
|
|
|
414
391
|
return (
|
|
415
392
|
<StyledButton
|
|
416
393
|
{...rest}
|
|
417
|
-
effect={
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
interactive: !readOnly && !rest.disabled,
|
|
422
|
-
...fixedEffect,
|
|
423
|
-
}
|
|
424
|
-
}
|
|
394
|
+
effect={{
|
|
395
|
+
interactive: !readOnly && !rest.disabled,
|
|
396
|
+
...fixedEffect,
|
|
397
|
+
}}
|
|
425
398
|
as='button'
|
|
426
399
|
theme={theme}
|
|
427
400
|
ref={targetRef}
|
|
@@ -442,12 +415,7 @@ const ReqoreButton = memo(
|
|
|
442
415
|
<StyledButtonContent size={size} wrap={wrap} description={description} flat={_flat}>
|
|
443
416
|
{icon && (
|
|
444
417
|
<>
|
|
445
|
-
<ReqoreIcon
|
|
446
|
-
icon={icon}
|
|
447
|
-
size={size}
|
|
448
|
-
color={leftIconColor || iconColor}
|
|
449
|
-
style={textAlign !== 'left' ? { marginRight: 'auto' } : undefined}
|
|
450
|
-
/>
|
|
418
|
+
<ReqoreIcon icon={icon} size={size} />
|
|
451
419
|
{children || badge || rightIcon ? (
|
|
452
420
|
<ReqoreSpacer width={PADDING_FROM_SIZE[size]} />
|
|
453
421
|
) : null}
|
|
@@ -455,15 +423,9 @@ const ReqoreButton = memo(
|
|
|
455
423
|
)}
|
|
456
424
|
{children && (
|
|
457
425
|
<StyledAnimatedTextWrapper textAlign={textAlign}>
|
|
458
|
-
<StyledActiveContent wrap={wrap}
|
|
459
|
-
|
|
460
|
-
</
|
|
461
|
-
<StyledInActiveContent wrap={wrap} effect={labelEffect}>
|
|
462
|
-
{children}
|
|
463
|
-
</StyledInActiveContent>
|
|
464
|
-
<StyledInvisibleContent wrap={wrap} effect={labelEffect}>
|
|
465
|
-
{children}
|
|
466
|
-
</StyledInvisibleContent>
|
|
426
|
+
<StyledActiveContent wrap={wrap}>{children}</StyledActiveContent>
|
|
427
|
+
<StyledInActiveContent wrap={wrap}>{children}</StyledInActiveContent>
|
|
428
|
+
<StyledInvisibleContent wrap={wrap}>{children}</StyledInvisibleContent>
|
|
467
429
|
{(badge || badge === 0) && wrap ? (
|
|
468
430
|
<ButtonBadge content={badge} size={size} color={color} wrap />
|
|
469
431
|
) : null}
|
|
@@ -475,25 +437,18 @@ const ReqoreButton = memo(
|
|
|
475
437
|
{rightIcon && (
|
|
476
438
|
<>
|
|
477
439
|
{children || badge ? <ReqoreSpacer width={PADDING_FROM_SIZE[size]} /> : null}
|
|
478
|
-
<ReqoreIcon
|
|
479
|
-
icon={rightIcon}
|
|
480
|
-
size={size}
|
|
481
|
-
style={textAlign !== 'right' ? { marginLeft: 'auto' } : undefined}
|
|
482
|
-
color={rightIconColor || iconColor}
|
|
483
|
-
/>
|
|
440
|
+
<ReqoreIcon icon={rightIcon} size={size} style={{ marginLeft: 'auto' }} />
|
|
484
441
|
</>
|
|
485
442
|
)}
|
|
486
443
|
</StyledButtonContent>
|
|
487
444
|
|
|
488
445
|
{description && (
|
|
489
446
|
<ReqoreTextEffect
|
|
490
|
-
className='reqore-button-description'
|
|
491
447
|
effect={{
|
|
492
448
|
textSize: getOneLessSize(size),
|
|
493
449
|
weight: 'light',
|
|
494
450
|
color: `${color}90`,
|
|
495
451
|
textAlign,
|
|
496
|
-
...descriptionEffect,
|
|
497
452
|
}}
|
|
498
453
|
>
|
|
499
454
|
{description}
|
|
@@ -137,8 +137,7 @@ const StyledCheckbox = styled.div<IReqoreCheckboxStyle>`
|
|
|
137
137
|
height: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
138
138
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
140
|
+
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1' : '0 0 auto')};
|
|
142
141
|
|
|
143
142
|
${({ disabled }) =>
|
|
144
143
|
disabled &&
|
|
@@ -273,7 +272,7 @@ const Checkbox = forwardRef<HTMLDivElement, IReqoreCheckboxProps>(
|
|
|
273
272
|
textSize: getOneLessSize(size),
|
|
274
273
|
weight: 'bold',
|
|
275
274
|
...switchTextEffect,
|
|
276
|
-
opacity: checked ? 0.
|
|
275
|
+
opacity: checked ? 0.8 : 1,
|
|
277
276
|
} as IReqoreEffect
|
|
278
277
|
}
|
|
279
278
|
>
|
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
import { size } from 'lodash';
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
|
-
import { useUpdateEffect } from 'react-use';
|
|
4
3
|
import styled, { css } from 'styled-components';
|
|
5
|
-
import {
|
|
4
|
+
import { ReqoreIntents } from '../../constants/theme';
|
|
6
5
|
import { IReqoreColumnsProps, StyledColumns } from '../Columns';
|
|
7
6
|
import ReqoreInput from '../Input';
|
|
8
7
|
import ReqoreMessage from '../Message';
|
|
9
|
-
import { IReqorePanelAction, IReqorePanelProps, ReqorePanel
|
|
8
|
+
import { IReqorePanelAction, IReqorePanelProps, ReqorePanel } from '../Panel';
|
|
10
9
|
import { sortTableData } from '../Table/helpers';
|
|
11
10
|
import { IReqoreCollectionItemProps, ReqoreCollectionItem } from './item';
|
|
12
11
|
|
|
13
12
|
export interface IReqoreCollectionProps
|
|
14
13
|
extends Pick<
|
|
15
14
|
IReqorePanelProps,
|
|
16
|
-
| '
|
|
17
|
-
| 'intent'
|
|
18
|
-
| 'customTheme'
|
|
19
|
-
| 'actions'
|
|
20
|
-
| 'bottomActions'
|
|
21
|
-
| 'label'
|
|
22
|
-
| 'headerSize'
|
|
23
|
-
| 'badge'
|
|
24
|
-
| 'icon'
|
|
25
|
-
| 'flat'
|
|
26
|
-
| 'minimal'
|
|
27
|
-
| 'transparent'
|
|
28
|
-
| 'fluid'
|
|
15
|
+
'size' | 'intent' | 'customTheme' | 'actions' | 'bottomActions' | 'label' | 'headerSize'
|
|
29
16
|
>,
|
|
30
17
|
IReqoreColumnsProps {
|
|
31
18
|
items?: IReqoreCollectionItemProps[];
|
|
@@ -36,10 +23,6 @@ export interface IReqoreCollectionProps
|
|
|
36
23
|
maxItemHeight?: number;
|
|
37
24
|
filterable?: boolean;
|
|
38
25
|
sortable?: boolean;
|
|
39
|
-
showAs?: 'list' | 'grid';
|
|
40
|
-
showSelectedFirst?: boolean;
|
|
41
|
-
selectedIcon?: IReqoreIconName;
|
|
42
|
-
emptyMessage?: string;
|
|
43
26
|
}
|
|
44
27
|
|
|
45
28
|
export const StyledCollectionWrapper = styled(StyledColumns)`
|
|
@@ -65,53 +48,17 @@ export const ReqoreCollection = ({
|
|
|
65
48
|
maxItemHeight,
|
|
66
49
|
filterable,
|
|
67
50
|
sortable,
|
|
68
|
-
showSelectedFirst,
|
|
69
51
|
headerSize = 2,
|
|
70
|
-
showAs = 'grid',
|
|
71
|
-
selectedIcon,
|
|
72
|
-
flat = true,
|
|
73
|
-
minimal,
|
|
74
|
-
transparent = true,
|
|
75
|
-
emptyMessage = 'No data in this collection, try changing your search query or filters',
|
|
76
52
|
...rest
|
|
77
53
|
}: IReqoreCollectionProps) => {
|
|
78
|
-
const [
|
|
54
|
+
const [showAs, setShowAs] = useState<'list' | 'grid'>('grid');
|
|
79
55
|
const [sort, setSort] = useState<'asc' | 'desc'>('asc');
|
|
80
56
|
const [query, setQuery] = useState<string>('');
|
|
81
57
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const sortedItems: IReqoreCollectionItemProps[] = useMemo(() => {
|
|
87
|
-
if (!sortable) {
|
|
88
|
-
return items;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (showSelectedFirst) {
|
|
92
|
-
// Filter out the selected items
|
|
93
|
-
const selectedItems = items.filter((item) => item.selected);
|
|
94
|
-
// Filter out the unselected items
|
|
95
|
-
const unselectedItems = items.filter((item) => !item.selected);
|
|
96
|
-
// Sort the selected items
|
|
97
|
-
const sortedSelectedItems = sortTableData(selectedItems, {
|
|
98
|
-
by: 'label',
|
|
99
|
-
direction: sort,
|
|
100
|
-
});
|
|
101
|
-
// Sort the unselected items
|
|
102
|
-
const sortedUnselectedItems = sortTableData(unselectedItems, {
|
|
103
|
-
by: 'label',
|
|
104
|
-
direction: sort,
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
return [...sortedSelectedItems, ...sortedUnselectedItems];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return sortTableData(items, {
|
|
111
|
-
by: 'label',
|
|
112
|
-
direction: sort,
|
|
113
|
-
});
|
|
114
|
-
}, [items, sort]);
|
|
58
|
+
const sortedItems: IReqoreCollectionItemProps[] = useMemo(
|
|
59
|
+
() => (sortable ? sortTableData(items, { by: 'label', direction: sort }) : items),
|
|
60
|
+
[items, sort]
|
|
61
|
+
);
|
|
115
62
|
|
|
116
63
|
const filteredItems: IReqoreCollectionItemProps[] = useMemo(() => {
|
|
117
64
|
if (!filterable || query === '') {
|
|
@@ -134,29 +81,8 @@ export const ReqoreCollection = ({
|
|
|
134
81
|
};
|
|
135
82
|
|
|
136
83
|
const finalItems = filteredItems;
|
|
137
|
-
const finalActions:
|
|
138
|
-
let actions:
|
|
139
|
-
|
|
140
|
-
const toolbarGroup: IReqorePanelAction = {
|
|
141
|
-
responsive: false,
|
|
142
|
-
group: [
|
|
143
|
-
{
|
|
144
|
-
icon: _showAs === 'grid' ? 'ListOrdered' : 'GridLine',
|
|
145
|
-
onClick: () => setShowAs(_showAs === 'grid' ? 'list' : 'grid'),
|
|
146
|
-
tooltip: _showAs === 'grid' ? 'Show as list' : 'Show as grid',
|
|
147
|
-
disabled: !size(finalItems),
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
if (sortable) {
|
|
153
|
-
toolbarGroup.group.push({
|
|
154
|
-
icon: sort === 'desc' ? 'SortDesc' : 'SortAsc',
|
|
155
|
-
onClick: () => setSort(sort === 'desc' ? 'asc' : 'desc'),
|
|
156
|
-
tooltip: sort === 'desc' ? 'Sort ascending' : 'Sort descending',
|
|
157
|
-
disabled: !size(finalItems),
|
|
158
|
-
});
|
|
159
|
-
}
|
|
84
|
+
const finalActions: (IReqorePanelAction[] | IReqorePanelAction)[] = useMemo(() => {
|
|
85
|
+
let actions: (IReqorePanelAction[] | IReqorePanelAction)[] = [];
|
|
160
86
|
|
|
161
87
|
if (filterable) {
|
|
162
88
|
actions = [
|
|
@@ -175,32 +101,74 @@ export const ReqoreCollection = ({
|
|
|
175
101
|
];
|
|
176
102
|
}
|
|
177
103
|
|
|
178
|
-
|
|
179
|
-
|
|
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]);
|
|
180
151
|
|
|
181
152
|
return (
|
|
182
153
|
<ReqorePanel
|
|
183
154
|
{...rest}
|
|
184
155
|
headerSize={headerSize}
|
|
185
156
|
style={{
|
|
186
|
-
...rest.style,
|
|
187
157
|
height: height ?? undefined,
|
|
188
158
|
}}
|
|
189
159
|
fill={fill}
|
|
190
160
|
padded
|
|
191
|
-
|
|
192
|
-
minimal={minimal}
|
|
193
|
-
flat={flat}
|
|
161
|
+
opacity={0}
|
|
194
162
|
actions={finalActions}
|
|
195
163
|
className={`reqore-collection ${rest.className || ''}`}
|
|
196
164
|
>
|
|
197
165
|
{!size(finalItems) ? (
|
|
198
166
|
<ReqoreMessage intent='muted' flat title='No items found'>
|
|
199
|
-
|
|
167
|
+
No data in this collection, try changing your search query or filters
|
|
200
168
|
</ReqoreMessage>
|
|
201
169
|
) : (
|
|
202
170
|
<StyledCollectionWrapper
|
|
203
|
-
columns={
|
|
171
|
+
columns={showAs === 'grid' ? 'auto-fit' : 1}
|
|
204
172
|
columnsGap={stacked ? '0px' : columnsGap}
|
|
205
173
|
rounded={rounded}
|
|
206
174
|
stacked={stacked}
|
|
@@ -209,7 +177,6 @@ export const ReqoreCollection = ({
|
|
|
209
177
|
{finalItems?.map((item) => (
|
|
210
178
|
<ReqoreCollectionItem
|
|
211
179
|
{...item}
|
|
212
|
-
icon={item.icon || (item.selected ? selectedIcon : undefined)}
|
|
213
180
|
key={item.id || item.label.toString()}
|
|
214
181
|
rounded={!stacked}
|
|
215
182
|
maxContentHeight={maxItemHeight}
|
|
@@ -7,13 +7,13 @@ import ReqoreContext from '../../context/ReqoreContext';
|
|
|
7
7
|
import { changeDarkness, getMainBackgroundColor } from '../../helpers/colors';
|
|
8
8
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
9
9
|
import { StyledBackdrop } from '../Drawer';
|
|
10
|
+
import { IReqoreDropdownItem } from '../Dropdown/list';
|
|
10
11
|
import {
|
|
11
12
|
IReqorePanelAction,
|
|
12
13
|
IReqorePanelBottomAction,
|
|
13
14
|
IReqorePanelProps,
|
|
14
15
|
ReqorePanel,
|
|
15
16
|
} from '../Panel';
|
|
16
|
-
import { ReqoreP } from '../Paragraph';
|
|
17
17
|
import { ReqoreSpacer } from '../Spacer';
|
|
18
18
|
import ReqoreTag, { IReqoreTagProps } from '../Tag';
|
|
19
19
|
import ReqoreTagGroup from '../Tag/group';
|
|
@@ -29,24 +29,22 @@ export interface IReqoreCollectionItemProps
|
|
|
29
29
|
| 'unMountContentOnCollapse'
|
|
30
30
|
| 'bottomActions'
|
|
31
31
|
> {
|
|
32
|
-
|
|
32
|
+
subHeader?: string;
|
|
33
33
|
content?: string | React.ReactNode;
|
|
34
34
|
expandable?: boolean;
|
|
35
35
|
expandedContent?: string | React.ReactNode;
|
|
36
36
|
expandedActions?: IReqorePanelBottomAction[];
|
|
37
37
|
image?: string;
|
|
38
|
-
actions?:
|
|
38
|
+
actions?: IReqoreDropdownItem[];
|
|
39
39
|
tags?: IReqoreTagProps[];
|
|
40
40
|
maxContentHeight?: number;
|
|
41
|
-
showContentFade?: boolean;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
export const StyledCollectionItemContent = styled.div`
|
|
45
44
|
max-height: ${({ providedHeight }) => (providedHeight ? `${providedHeight}px` : 'auto')};
|
|
46
|
-
overflow:
|
|
45
|
+
overflow: hidden;
|
|
47
46
|
position: relative;
|
|
48
47
|
transition: 0.3s ease-in-out;
|
|
49
|
-
flex: 1;
|
|
50
48
|
|
|
51
49
|
${({ contentOverflows, theme, opacity = 1 }) =>
|
|
52
50
|
contentOverflows &&
|
|
@@ -71,6 +69,7 @@ export const StyledCollectionItemContent = styled.div`
|
|
|
71
69
|
export const ReqoreCollectionItem = ({
|
|
72
70
|
flat = true,
|
|
73
71
|
minimal = true,
|
|
72
|
+
headerSize = 3,
|
|
74
73
|
style,
|
|
75
74
|
content,
|
|
76
75
|
actions,
|
|
@@ -79,7 +78,6 @@ export const ReqoreCollectionItem = ({
|
|
|
79
78
|
expandedContent,
|
|
80
79
|
expandedActions,
|
|
81
80
|
maxContentHeight,
|
|
82
|
-
showContentFade = true,
|
|
83
81
|
...rest
|
|
84
82
|
}: IReqoreCollectionItemProps) => {
|
|
85
83
|
const [isSelected, setIsSelected] = useState(false);
|
|
@@ -184,7 +182,7 @@ export const ReqoreCollectionItem = ({
|
|
|
184
182
|
{ icon: 'CloseLine', onClick: handleItemClick },
|
|
185
183
|
] as IReqorePanelAction[])
|
|
186
184
|
: size(actions)
|
|
187
|
-
? actions
|
|
185
|
+
? [{ icon: 'More2Fill', actions, minimal: true, flat: true }]
|
|
188
186
|
: undefined;
|
|
189
187
|
|
|
190
188
|
return (
|
|
@@ -202,6 +200,7 @@ export const ReqoreCollectionItem = ({
|
|
|
202
200
|
)}
|
|
203
201
|
<ReqorePanel
|
|
204
202
|
flat={flat}
|
|
203
|
+
headerSize={headerSize}
|
|
205
204
|
ref={ref}
|
|
206
205
|
minimal={minimal}
|
|
207
206
|
{...rest}
|
|
@@ -213,37 +212,18 @@ export const ReqoreCollectionItem = ({
|
|
|
213
212
|
...dimensions,
|
|
214
213
|
transformOrigin: 'center',
|
|
215
214
|
}}
|
|
216
|
-
contentStyle={{
|
|
217
|
-
...rest.contentStyle,
|
|
218
|
-
display: 'flex',
|
|
219
|
-
flexFlow: 'column',
|
|
220
|
-
justifyContent: 'space-between',
|
|
221
|
-
}}
|
|
222
215
|
onClick={(expandable && !isSelected) || rest.onClick ? handleItemClick : undefined}
|
|
223
216
|
actions={actualActions}
|
|
224
217
|
className={`reqore-collection-item ${rest.className || ''}`}
|
|
225
218
|
>
|
|
226
219
|
<StyledCollectionItemContent
|
|
227
220
|
theme={theme}
|
|
228
|
-
opacity={rest.
|
|
221
|
+
opacity={rest.opacity}
|
|
229
222
|
providedHeight={isSelected ? undefined : maxContentHeight}
|
|
230
|
-
|
|
231
|
-
contentOverflows={
|
|
232
|
-
!rest.transparent &&
|
|
233
|
-
!rest.contentEffect &&
|
|
234
|
-
!isSelected &&
|
|
235
|
-
sizes?.height > maxContentHeight &&
|
|
236
|
-
showContentFade
|
|
237
|
-
}
|
|
223
|
+
contentOverflows={!isSelected && sizes?.height > maxContentHeight}
|
|
238
224
|
>
|
|
239
225
|
<div ref={contentRef}>{actualContent}</div>
|
|
240
226
|
</StyledCollectionItemContent>
|
|
241
|
-
{showContentFade &&
|
|
242
|
-
(rest.contentEffect || rest.transparent) &&
|
|
243
|
-
!isSelected &&
|
|
244
|
-
sizes?.height > maxContentHeight ? (
|
|
245
|
-
<ReqoreP>...</ReqoreP>
|
|
246
|
-
) : null}
|
|
247
227
|
{size(tags) ? (
|
|
248
228
|
<>
|
|
249
229
|
<ReqoreSpacer height={10} />
|