@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
|
@@ -4,8 +4,6 @@ import { ReactElement, forwardRef, useCallback, useMemo, useState } from 'react'
|
|
|
4
4
|
import { useUpdateEffect } from 'react-use';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import {
|
|
7
|
-
GAP_FROM_SIZE,
|
|
8
|
-
HEADER_SIZE_TO_NUMBER,
|
|
9
7
|
ICON_FROM_HEADER_SIZE,
|
|
10
8
|
PADDING_FROM_SIZE,
|
|
11
9
|
RADIUS_FROM_SIZE,
|
|
@@ -19,7 +17,6 @@ import {
|
|
|
19
17
|
getMainBackgroundColor,
|
|
20
18
|
getReadableColor,
|
|
21
19
|
} from '../../helpers/colors';
|
|
22
|
-
import { isActionShown } from '../../helpers/utils';
|
|
23
20
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
24
21
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
25
22
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
@@ -28,7 +25,6 @@ import {
|
|
|
28
25
|
IReqoreIntent,
|
|
29
26
|
IWithReqoreCustomTheme,
|
|
30
27
|
IWithReqoreFlat,
|
|
31
|
-
IWithReqoreFluid,
|
|
32
28
|
IWithReqoreSize,
|
|
33
29
|
IWithReqoreTooltip,
|
|
34
30
|
} from '../../types/global';
|
|
@@ -41,20 +37,17 @@ import { IReqoreDropdownItem } from '../Dropdown/list';
|
|
|
41
37
|
import { IReqoreEffect, StyledEffect, TReqoreEffectColor } from '../Effect';
|
|
42
38
|
import { ReqoreHeading } from '../Header';
|
|
43
39
|
import ReqoreIcon, { StyledIconWrapper } from '../Icon';
|
|
44
|
-
import {
|
|
40
|
+
import { ReqoreSpacer } from '../Spacer';
|
|
45
41
|
|
|
46
42
|
export interface IReqorePanelAction extends IReqoreButtonProps, IWithReqoreTooltip, IReqoreIntent {
|
|
47
43
|
label?: string | number;
|
|
48
44
|
onClick?: () => void;
|
|
49
|
-
group?: IReqorePanelAction[];
|
|
50
45
|
actions?: Omit<IReqoreDropdownItem[], 'value'>;
|
|
51
46
|
// Custom react element
|
|
52
47
|
as?: React.ElementType;
|
|
53
|
-
props?:
|
|
48
|
+
props?: any;
|
|
54
49
|
// Hide the action if the condition is false
|
|
55
50
|
show?: boolean;
|
|
56
|
-
// Hide the action if the group is too small
|
|
57
|
-
responsive?: boolean;
|
|
58
51
|
}
|
|
59
52
|
|
|
60
53
|
export interface IReqorePanelBottomAction extends IReqorePanelAction {
|
|
@@ -62,8 +55,6 @@ export interface IReqorePanelBottomAction extends IReqorePanelAction {
|
|
|
62
55
|
}
|
|
63
56
|
|
|
64
57
|
export interface IReqorePanelContent {}
|
|
65
|
-
export type TReqorePanelActions = IReqorePanelAction[];
|
|
66
|
-
export type TReqorePanelBottomActions = IReqorePanelBottomAction[];
|
|
67
58
|
|
|
68
59
|
export interface IReqorePanelProps
|
|
69
60
|
extends IWithReqoreSize,
|
|
@@ -71,7 +62,6 @@ export interface IReqorePanelProps
|
|
|
71
62
|
IWithReqoreFlat,
|
|
72
63
|
IReqoreIntent,
|
|
73
64
|
IWithReqoreTooltip,
|
|
74
|
-
IWithReqoreFluid,
|
|
75
65
|
React.HTMLAttributes<HTMLDivElement> {
|
|
76
66
|
as?: any;
|
|
77
67
|
children?: any;
|
|
@@ -82,8 +72,8 @@ export interface IReqorePanelProps
|
|
|
82
72
|
isCollapsed?: boolean;
|
|
83
73
|
onClose?: () => void;
|
|
84
74
|
rounded?: boolean;
|
|
85
|
-
actions?:
|
|
86
|
-
bottomActions?:
|
|
75
|
+
actions?: (IReqorePanelAction | IReqorePanelAction[])[];
|
|
76
|
+
bottomActions?: IReqorePanelBottomAction[];
|
|
87
77
|
unMountContentOnCollapse?: boolean;
|
|
88
78
|
onCollapseChange?: (isCollapsed?: boolean) => void;
|
|
89
79
|
fill?: boolean;
|
|
@@ -97,7 +87,6 @@ export interface IReqorePanelProps
|
|
|
97
87
|
contentEffect?: IReqoreEffect;
|
|
98
88
|
headerEffect?: IReqoreEffect;
|
|
99
89
|
transparent?: boolean;
|
|
100
|
-
iconColor?: TReqoreEffectColor;
|
|
101
90
|
}
|
|
102
91
|
|
|
103
92
|
export interface IStyledPanel extends IReqorePanelProps {
|
|
@@ -109,12 +98,12 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
|
|
|
109
98
|
background-color: ${({ theme, opacity = 1 }: IStyledPanel) =>
|
|
110
99
|
rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)};
|
|
111
100
|
border-radius: ${({ rounded }) => (rounded ? RADIUS_FROM_SIZE.normal : 0)}px;
|
|
112
|
-
border: ${({ theme, flat, intent }) =>
|
|
101
|
+
border: ${({ theme, flat, opacity = 1, intent }) =>
|
|
113
102
|
flat && !intent
|
|
114
103
|
? undefined
|
|
115
|
-
: `1px solid ${
|
|
116
|
-
intent ? theme.intents[intent] : getMainBackgroundColor(theme),
|
|
117
|
-
|
|
104
|
+
: `1px solid ${rgba(
|
|
105
|
+
changeLightness(intent ? theme.intents[intent] : getMainBackgroundColor(theme), 0.2),
|
|
106
|
+
opacity
|
|
118
107
|
)}`};
|
|
119
108
|
color: ${({ theme }) => getReadableColor(theme, undefined, undefined, true)};
|
|
120
109
|
overflow: hidden;
|
|
@@ -123,9 +112,7 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
|
|
|
123
112
|
position: relative;
|
|
124
113
|
backdrop-filter: ${({ blur, opacity }) => (blur && opacity < 1 ? `blur(${blur}px)` : undefined)};
|
|
125
114
|
transition: 0.2s ease-in-out;
|
|
126
|
-
|
|
127
|
-
max-width: 100%;
|
|
128
|
-
flex: ${({ fluid }) => (fluid ? '1 auto' : '0 0 auto')};
|
|
115
|
+
flex: auto;
|
|
129
116
|
|
|
130
117
|
${({ interactive, theme, opacity = 1, flat, intent }) =>
|
|
131
118
|
interactive
|
|
@@ -137,37 +124,35 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
|
|
|
137
124
|
transform: scale(${ACTIVE_ICON_SCALE});
|
|
138
125
|
}
|
|
139
126
|
|
|
140
|
-
background-color: ${
|
|
141
|
-
|
|
142
|
-
:
|
|
143
|
-
|
|
144
|
-
opacity
|
|
145
|
-
)};
|
|
127
|
+
background-color: ${rgba(
|
|
128
|
+
darken(0.025, rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)),
|
|
129
|
+
opacity === 0 ? 0.2 : opacity
|
|
130
|
+
)};
|
|
146
131
|
|
|
147
132
|
border-color: ${flat && !intent
|
|
148
133
|
? undefined
|
|
149
|
-
: `${
|
|
150
|
-
|
|
151
|
-
|
|
134
|
+
: `${rgba(
|
|
135
|
+
changeLightness(
|
|
136
|
+
intent ? theme.intents[intent] : getMainBackgroundColor(theme),
|
|
137
|
+
0.25
|
|
138
|
+
),
|
|
139
|
+
opacity
|
|
152
140
|
)}`};
|
|
153
141
|
|
|
154
|
-
${
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
`}
|
|
142
|
+
${StyledCollectionItemContent}:after {
|
|
143
|
+
background: linear-gradient(
|
|
144
|
+
to top,
|
|
145
|
+
${rgba(
|
|
146
|
+
darken(
|
|
147
|
+
0.025,
|
|
148
|
+
rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)
|
|
149
|
+
),
|
|
150
|
+
opacity === 0 ? 0.2 : opacity
|
|
151
|
+
)}
|
|
152
|
+
0%,
|
|
153
|
+
transparent 100%
|
|
154
|
+
);
|
|
155
|
+
}
|
|
171
156
|
}
|
|
172
157
|
`
|
|
173
158
|
: undefined}
|
|
@@ -186,10 +171,12 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
|
|
|
186
171
|
background-color: ${({ theme, opacity = 1 }: IStyledPanel) =>
|
|
187
172
|
rgba(changeLightness(getMainBackgroundColor(theme), 0.03), opacity)};
|
|
188
173
|
justify-content: space-between;
|
|
189
|
-
|
|
174
|
+
height: 40px;
|
|
190
175
|
align-items: center;
|
|
191
|
-
padding: ${({ noHorizontalPadding,
|
|
192
|
-
|
|
176
|
+
padding: ${({ noHorizontalPadding, contentSize }: IStyledPanel) =>
|
|
177
|
+
`0 ${noHorizontalPadding ? 0 : '5px'} 0 ${
|
|
178
|
+
noHorizontalPadding ? 0 : `${TEXT_FROM_SIZE[contentSize]}px`
|
|
179
|
+
}`};
|
|
193
180
|
border-bottom: ${({ theme, isCollapsed, flat, opacity = 1 }) =>
|
|
194
181
|
!isCollapsed && !flat
|
|
195
182
|
? `1px solid ${rgba(changeLightness(getMainBackgroundColor(theme), 0.2), opacity)}`
|
|
@@ -218,8 +205,7 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
|
|
|
218
205
|
`;
|
|
219
206
|
|
|
220
207
|
export const StyledPanelBottomActions = styled(StyledPanelTitle)`
|
|
221
|
-
padding: ${({ noHorizontalPadding
|
|
222
|
-
`${PADDING_FROM_SIZE[size]}px ${noHorizontalPadding ? 0 : `${PADDING_FROM_SIZE[size]}px`}`};
|
|
208
|
+
padding: ${({ noHorizontalPadding }: IStyledPanel) => `0 ${noHorizontalPadding ? 0 : '5px'}`};
|
|
223
209
|
border-bottom: 0;
|
|
224
210
|
border-top: ${({ theme, flat, opacity = 1 }) =>
|
|
225
211
|
!flat
|
|
@@ -228,33 +214,29 @@ export const StyledPanelBottomActions = styled(StyledPanelTitle)`
|
|
|
228
214
|
`;
|
|
229
215
|
|
|
230
216
|
export const StyledPanelContent = styled.div<IStyledPanel>`
|
|
231
|
-
display: ${({ isCollapsed }) => (isCollapsed ? 'none
|
|
232
|
-
padding: ${({ padded,
|
|
217
|
+
display: ${({ isCollapsed }) => (isCollapsed ? 'none' : undefined)};
|
|
218
|
+
padding: ${({ padded, contentSize, noHorizontalPadding }) =>
|
|
233
219
|
!padded
|
|
234
220
|
? undefined
|
|
235
221
|
: noHorizontalPadding
|
|
236
|
-
? `${
|
|
237
|
-
: `${
|
|
222
|
+
? `${TEXT_FROM_SIZE[contentSize]}px 0`
|
|
223
|
+
: `${TEXT_FROM_SIZE[contentSize]}px`};
|
|
238
224
|
// The padding is not needed when the panel is minimal and has title, since
|
|
239
225
|
// the title already has padding and is transparent
|
|
240
|
-
padding-top: ${({ minimal, hasLabel, padded
|
|
241
|
-
minimal && hasLabel && padded ?
|
|
242
|
-
padding-bottom: ${({ minimal, padded
|
|
243
|
-
minimal && padded ? `${PADDING_FROM_SIZE[size]}px` : undefined};
|
|
226
|
+
padding-top: ${({ minimal, hasLabel, padded }) =>
|
|
227
|
+
minimal && hasLabel && padded ? '0px' : undefined};
|
|
228
|
+
padding-bottom: ${({ minimal, padded }) => (minimal && padded ? '10px' : undefined)};
|
|
244
229
|
flex: 1;
|
|
245
230
|
overflow: auto;
|
|
246
|
-
font-size: ${({
|
|
231
|
+
font-size: ${({ contentSize }) => TEXT_FROM_SIZE[contentSize]}px;
|
|
247
232
|
`;
|
|
248
233
|
|
|
249
234
|
export const StyledPanelTitleHeader = styled.div`
|
|
250
235
|
display: flex;
|
|
251
|
-
justify-content:
|
|
236
|
+
justify-content: center;
|
|
252
237
|
align-items: center;
|
|
253
|
-
padding-right: 5px;
|
|
254
|
-
flex: 1 1 auto;
|
|
255
|
-
width: 100%;
|
|
256
238
|
overflow: hidden;
|
|
257
|
-
|
|
239
|
+
padding-right: 5px;
|
|
258
240
|
`;
|
|
259
241
|
|
|
260
242
|
export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
@@ -279,14 +261,11 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
279
261
|
contentStyle,
|
|
280
262
|
contentEffect,
|
|
281
263
|
headerEffect = {},
|
|
282
|
-
headerSize,
|
|
283
|
-
contentSize,
|
|
264
|
+
headerSize = 4,
|
|
265
|
+
contentSize = 'normal',
|
|
284
266
|
minimal,
|
|
285
267
|
tooltip,
|
|
286
268
|
badge,
|
|
287
|
-
iconColor,
|
|
288
|
-
fluid,
|
|
289
|
-
size: panelSize = 'normal',
|
|
290
269
|
...rest
|
|
291
270
|
}: IReqorePanelProps,
|
|
292
271
|
ref
|
|
@@ -309,13 +288,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
309
288
|
|
|
310
289
|
// Return true if the card has a title bar, otherwise return false.
|
|
311
290
|
const hasTitleBar: boolean = useMemo(
|
|
312
|
-
() =>
|
|
313
|
-
!!label ||
|
|
314
|
-
collapsible ||
|
|
315
|
-
!!onClose ||
|
|
316
|
-
!!size(actions.filter(isActionShown)) ||
|
|
317
|
-
!!badge ||
|
|
318
|
-
!!icon,
|
|
291
|
+
() => !!label || collapsible || !!onClose || !!size(actions) || !!badge,
|
|
319
292
|
[label, collapsible, onClose, actions, badge]
|
|
320
293
|
);
|
|
321
294
|
|
|
@@ -342,47 +315,21 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
342
315
|
|
|
343
316
|
// Calculates whether or not the bottom actions should be displayed.
|
|
344
317
|
const hasBottomActions: boolean = useMemo(
|
|
345
|
-
() =>
|
|
346
|
-
!!(
|
|
347
|
-
size(leftBottomActions.filter(isActionShown)) ||
|
|
348
|
-
size(rightBottomActions.filter(isActionShown))
|
|
349
|
-
),
|
|
318
|
+
() => !!(size(leftBottomActions) || size(rightBottomActions)),
|
|
350
319
|
[leftBottomActions, rightBottomActions]
|
|
351
320
|
);
|
|
352
321
|
|
|
353
|
-
const renderResponsiveActions = useCallback(
|
|
354
|
-
(action: IReqorePanelAction, index: number) => {
|
|
355
|
-
return renderActions(action, index, true);
|
|
356
|
-
},
|
|
357
|
-
[actions]
|
|
358
|
-
);
|
|
359
|
-
|
|
360
|
-
const hasNonResponsiveActions = useCallback(
|
|
361
|
-
(data: TReqorePanelActions) =>
|
|
362
|
-
data.some((action) => action.responsive === false && action.show !== false),
|
|
363
|
-
[actions, bottomActions]
|
|
364
|
-
);
|
|
365
|
-
|
|
366
|
-
const hasResponsiveActions = useCallback(
|
|
367
|
-
(data: TReqorePanelActions) =>
|
|
368
|
-
data.some((action) => action.responsive !== false && action.show !== false),
|
|
369
|
-
[actions, bottomActions]
|
|
370
|
-
);
|
|
371
|
-
|
|
372
|
-
const renderNonResponsiveActions = useCallback(
|
|
373
|
-
(action: IReqorePanelAction, index: number) => {
|
|
374
|
-
return renderActions(action, index, false);
|
|
375
|
-
},
|
|
376
|
-
[actions]
|
|
377
|
-
);
|
|
378
|
-
|
|
379
322
|
const renderActions = useCallback(
|
|
380
|
-
(
|
|
381
|
-
if (
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
323
|
+
(actionOrActions: IReqorePanelAction | IReqorePanelAction[], index: number) => {
|
|
324
|
+
if (Array.isArray(actionOrActions)) {
|
|
325
|
+
return (
|
|
326
|
+
<ReqoreControlGroup key={index} stack>
|
|
327
|
+
{actionOrActions.map(renderActions)}
|
|
328
|
+
</ReqoreControlGroup>
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (actionOrActions.show === false) {
|
|
386
333
|
return null;
|
|
387
334
|
}
|
|
388
335
|
|
|
@@ -393,38 +340,20 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
393
340
|
intent,
|
|
394
341
|
className,
|
|
395
342
|
as: CustomElement,
|
|
396
|
-
props
|
|
397
|
-
group,
|
|
343
|
+
props,
|
|
398
344
|
...rest
|
|
399
|
-
}: IReqorePanelAction =
|
|
400
|
-
|
|
401
|
-
if (size(group)) {
|
|
402
|
-
return (
|
|
403
|
-
<ReqoreControlGroup
|
|
404
|
-
intent={intent}
|
|
405
|
-
stack
|
|
406
|
-
customTheme={rest.customTheme || theme}
|
|
407
|
-
size={rest.size}
|
|
408
|
-
fixed
|
|
409
|
-
fluid={rest.fluid}
|
|
410
|
-
key={index}
|
|
411
|
-
>
|
|
412
|
-
{group.map((action, index) => renderActions(action, index, true))}
|
|
413
|
-
</ReqoreControlGroup>
|
|
414
|
-
);
|
|
415
|
-
}
|
|
345
|
+
}: IReqorePanelAction = actionOrActions;
|
|
416
346
|
|
|
417
347
|
if (size(actions)) {
|
|
418
348
|
return (
|
|
419
349
|
<ReqoreDropdown<IReqoreButtonProps>
|
|
420
350
|
{...rest}
|
|
421
351
|
key={index}
|
|
422
|
-
fixed
|
|
423
352
|
label={label}
|
|
424
353
|
items={actions}
|
|
425
354
|
intent={intent}
|
|
426
355
|
className={className}
|
|
427
|
-
customTheme={
|
|
356
|
+
customTheme={theme}
|
|
428
357
|
onClick={(e: React.MouseEvent<HTMLButtonElement>) => e.stopPropagation()}
|
|
429
358
|
id={id}
|
|
430
359
|
/>
|
|
@@ -434,10 +363,9 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
434
363
|
if (CustomElement) {
|
|
435
364
|
return (
|
|
436
365
|
<CustomElement
|
|
437
|
-
fixed
|
|
438
366
|
{...props}
|
|
439
367
|
key={index}
|
|
440
|
-
customTheme={
|
|
368
|
+
customTheme={theme}
|
|
441
369
|
onClick={(e: React.MouseEvent<any>) => {
|
|
442
370
|
e.stopPropagation();
|
|
443
371
|
props?.onClick?.(e);
|
|
@@ -450,10 +378,9 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
450
378
|
<ReqoreButton
|
|
451
379
|
{...rest}
|
|
452
380
|
id={id}
|
|
453
|
-
fixed
|
|
454
381
|
key={index}
|
|
455
382
|
className={className}
|
|
456
|
-
customTheme={
|
|
383
|
+
customTheme={theme}
|
|
457
384
|
intent={intent}
|
|
458
385
|
onClick={
|
|
459
386
|
rest.onClick
|
|
@@ -482,7 +409,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
482
409
|
const transformedContentEffect: IReqoreEffect = useMemo(() => {
|
|
483
410
|
const newContentEffect: IReqoreEffect = { ...contentEffect };
|
|
484
411
|
|
|
485
|
-
if (newContentEffect
|
|
412
|
+
if (newContentEffect?.gradient) {
|
|
486
413
|
newContentEffect.gradient.borderColor = intent
|
|
487
414
|
? theme.intents[intent]
|
|
488
415
|
: newContentEffect.gradient.borderColor;
|
|
@@ -494,7 +421,6 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
494
421
|
}, [intent, theme, contentEffect, interactive]);
|
|
495
422
|
|
|
496
423
|
const opacity = rest.transparent ? 0 : rest.opacity;
|
|
497
|
-
const noHorizontalPadding = opacity === 0 && flat && !intent;
|
|
498
424
|
|
|
499
425
|
return (
|
|
500
426
|
<StyledPanel
|
|
@@ -510,7 +436,6 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
510
436
|
theme={theme}
|
|
511
437
|
effect={transformedContentEffect}
|
|
512
438
|
opacity={opacity}
|
|
513
|
-
fluid={fluid}
|
|
514
439
|
>
|
|
515
440
|
{hasTitleBar && (
|
|
516
441
|
<StyledPanelTitle
|
|
@@ -520,24 +445,21 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
520
445
|
className='reqore-panel-title'
|
|
521
446
|
onClick={handleCollapseClick}
|
|
522
447
|
theme={theme}
|
|
523
|
-
|
|
448
|
+
contentSize={contentSize}
|
|
524
449
|
opacity={opacity ?? (minimal ? 0 : 1)}
|
|
525
|
-
noHorizontalPadding={
|
|
450
|
+
noHorizontalPadding={opacity === 0}
|
|
526
451
|
>
|
|
527
452
|
<StyledPanelTitleHeader>
|
|
528
453
|
{icon && (
|
|
529
454
|
<ReqoreIcon
|
|
530
|
-
size={`${
|
|
531
|
-
ICON_FROM_HEADER_SIZE[headerSize || HEADER_SIZE_TO_NUMBER[panelSize]]
|
|
532
|
-
}px`}
|
|
455
|
+
size={`${ICON_FROM_HEADER_SIZE[headerSize]}px`}
|
|
533
456
|
icon={icon}
|
|
534
457
|
margin='right'
|
|
535
|
-
color={iconColor}
|
|
536
458
|
/>
|
|
537
459
|
)}
|
|
538
460
|
{typeof label === 'string' ? (
|
|
539
461
|
<ReqoreHeading
|
|
540
|
-
size={headerSize
|
|
462
|
+
size={headerSize}
|
|
541
463
|
customTheme={theme}
|
|
542
464
|
effect={{
|
|
543
465
|
noWrap: true,
|
|
@@ -553,52 +475,34 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
553
475
|
<>
|
|
554
476
|
<ButtonBadge
|
|
555
477
|
color={changeLightness(theme.main, 0.18)}
|
|
556
|
-
size=
|
|
478
|
+
size='big'
|
|
557
479
|
content={badge}
|
|
558
480
|
/>
|
|
559
481
|
<ReqoreSpacer width={PADDING_FROM_SIZE.normal} />
|
|
560
482
|
</>
|
|
561
483
|
) : null}
|
|
562
484
|
</StyledPanelTitleHeader>
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
tooltip={_isCollapsed ? 'Expand' : 'Collapse'}
|
|
585
|
-
fixed
|
|
586
|
-
/>
|
|
587
|
-
)}
|
|
588
|
-
{onClose && (
|
|
589
|
-
<ReqoreButton
|
|
590
|
-
fixed
|
|
591
|
-
customTheme={theme}
|
|
592
|
-
icon='CloseLine'
|
|
593
|
-
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
|
|
594
|
-
e.stopPropagation();
|
|
595
|
-
onClose?.();
|
|
596
|
-
}}
|
|
597
|
-
/>
|
|
598
|
-
)}
|
|
599
|
-
</ReqoreControlGroup>
|
|
600
|
-
</>
|
|
601
|
-
) : null}
|
|
485
|
+
<ReqoreControlGroup>
|
|
486
|
+
{actions.map(renderActions)}
|
|
487
|
+
{collapsible && (
|
|
488
|
+
<ReqoreButton
|
|
489
|
+
customTheme={theme}
|
|
490
|
+
icon={_isCollapsed ? 'ArrowDownSLine' : 'ArrowUpSLine'}
|
|
491
|
+
onClick={handleCollapseClick}
|
|
492
|
+
tooltip={_isCollapsed ? 'Expand' : 'Collapse'}
|
|
493
|
+
/>
|
|
494
|
+
)}
|
|
495
|
+
{onClose && (
|
|
496
|
+
<ReqoreButton
|
|
497
|
+
customTheme={theme}
|
|
498
|
+
icon='CloseLine'
|
|
499
|
+
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
|
|
500
|
+
e.stopPropagation();
|
|
501
|
+
onClose?.();
|
|
502
|
+
}}
|
|
503
|
+
/>
|
|
504
|
+
)}
|
|
505
|
+
</ReqoreControlGroup>
|
|
602
506
|
</StyledPanelTitle>
|
|
603
507
|
)}
|
|
604
508
|
{!_isCollapsed || (_isCollapsed && !unMountContentOnCollapse) ? (
|
|
@@ -610,8 +514,8 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
610
514
|
style={contentStyle}
|
|
611
515
|
padded={padded}
|
|
612
516
|
minimal={minimal}
|
|
613
|
-
|
|
614
|
-
noHorizontalPadding={
|
|
517
|
+
contentSize={contentSize}
|
|
518
|
+
noHorizontalPadding={opacity === 0}
|
|
615
519
|
>
|
|
616
520
|
{children}
|
|
617
521
|
</StyledPanelContent>
|
|
@@ -622,41 +526,10 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
622
526
|
className='reqore-panel-bottom-actions'
|
|
623
527
|
theme={theme}
|
|
624
528
|
opacity={opacity ?? (minimal ? 0 : 1)}
|
|
625
|
-
|
|
626
|
-
noHorizontalPadding={noHorizontalPadding}
|
|
529
|
+
noHorizontalPadding={opacity === 0}
|
|
627
530
|
>
|
|
628
|
-
{
|
|
629
|
-
|
|
630
|
-
<ReqoreControlGroup size={panelSize}>
|
|
631
|
-
{leftBottomActions.map(renderNonResponsiveActions)}
|
|
632
|
-
</ReqoreControlGroup>
|
|
633
|
-
<ReqoreHorizontalSpacer width={GAP_FROM_SIZE.normal} />
|
|
634
|
-
</>
|
|
635
|
-
) : null}
|
|
636
|
-
{hasResponsiveActions(leftBottomActions) && (
|
|
637
|
-
<ReqoreControlGroup fluid responsive customTheme={theme} size={panelSize}>
|
|
638
|
-
{leftBottomActions.map(renderResponsiveActions)}
|
|
639
|
-
</ReqoreControlGroup>
|
|
640
|
-
)}
|
|
641
|
-
{hasResponsiveActions(rightBottomActions) && (
|
|
642
|
-
<ReqoreControlGroup
|
|
643
|
-
fluid
|
|
644
|
-
horizontalAlign='flex-end'
|
|
645
|
-
responsive
|
|
646
|
-
customTheme={theme}
|
|
647
|
-
size={panelSize}
|
|
648
|
-
>
|
|
649
|
-
{rightBottomActions.map(renderResponsiveActions)}
|
|
650
|
-
</ReqoreControlGroup>
|
|
651
|
-
)}
|
|
652
|
-
{hasNonResponsiveActions(rightBottomActions) ? (
|
|
653
|
-
<>
|
|
654
|
-
<ReqoreHorizontalSpacer width={GAP_FROM_SIZE.normal} />
|
|
655
|
-
<ReqoreControlGroup horizontalAlign='flex-end' size={panelSize}>
|
|
656
|
-
{rightBottomActions.map(renderNonResponsiveActions)}
|
|
657
|
-
</ReqoreControlGroup>
|
|
658
|
-
</>
|
|
659
|
-
) : null}
|
|
531
|
+
<ReqoreControlGroup>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
532
|
+
<ReqoreControlGroup>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
660
533
|
</StyledPanelBottomActions>
|
|
661
534
|
) : null}
|
|
662
535
|
</StyledPanel>
|
|
@@ -8,6 +8,7 @@ export interface IReqorePopoverProps extends IReqoreComponent, IPopoverOptions {
|
|
|
8
8
|
componentProps?: any;
|
|
9
9
|
children?: any;
|
|
10
10
|
isReqoreComponent?: boolean;
|
|
11
|
+
noWrapper?: boolean;
|
|
11
12
|
wrapperTag?: string;
|
|
12
13
|
wrapperStyle?: React.CSSProperties;
|
|
13
14
|
}
|
|
@@ -22,6 +23,7 @@ const Popover = memo(
|
|
|
22
23
|
componentProps,
|
|
23
24
|
children,
|
|
24
25
|
isReqoreComponent,
|
|
26
|
+
noWrapper,
|
|
25
27
|
wrapperTag = 'span',
|
|
26
28
|
wrapperStyle = {},
|
|
27
29
|
passPopoverData,
|
|
@@ -37,7 +39,7 @@ const Popover = memo(
|
|
|
37
39
|
passPopoverData?.(popoverData);
|
|
38
40
|
}, [popoverData]);
|
|
39
41
|
|
|
40
|
-
if (isReqoreComponent) {
|
|
42
|
+
if (isReqoreComponent || noWrapper) {
|
|
41
43
|
return (
|
|
42
44
|
<Component
|
|
43
45
|
{...componentProps}
|