@qoretechnologies/reqore 0.30.4 → 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 +1 -4
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +7 -10
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.js +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 -20
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +55 -241
- 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 +9 -9
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +1 -1
- 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 +6 -9
- 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/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/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 +3 -4
- 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 -20
- 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/utils.d.ts +0 -2
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +2 -4
- 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 +5 -17
- package/src/components/Checkbox/index.tsx +1 -1
- 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 +103 -426
- package/src/components/Drawer/index.tsx +27 -28
- package/src/components/Dropdown/index.tsx +1 -3
- package/src/components/Effect/index.tsx +0 -1
- package/src/components/Icon/index.tsx +62 -81
- package/src/components/Input/index.tsx +4 -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/helpers.ts +6 -12
- package/src/components/Table/index.tsx +0 -1
- 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 +0 -4
- package/src/components/Tag/group.tsx +12 -6
- package/src/components/Tag/index.tsx +35 -67
- 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/utils.ts +0 -3
- 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 +6 -14
- 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 +34 -220
- 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 -32
- 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
|
@@ -27,7 +27,7 @@ export interface IReqoreDrawerProps extends Omit<IReqorePanelProps, 'size'> {
|
|
|
27
27
|
onClose?: () => void;
|
|
28
28
|
onHideToggle?: (isHidden: boolean) => void;
|
|
29
29
|
hasBackdrop?: boolean;
|
|
30
|
-
size?: string
|
|
30
|
+
size?: string;
|
|
31
31
|
maxSize?: string;
|
|
32
32
|
minSize?: string;
|
|
33
33
|
opacity?: number;
|
|
@@ -170,7 +170,6 @@ export const ReqoreDrawer = ({
|
|
|
170
170
|
_isModal,
|
|
171
171
|
width,
|
|
172
172
|
height,
|
|
173
|
-
actions = [],
|
|
174
173
|
...rest
|
|
175
174
|
}: IReqoreDrawerProps) => {
|
|
176
175
|
const { animations } = useContext(ReqoreContext);
|
|
@@ -200,13 +199,12 @@ export const ReqoreDrawer = ({
|
|
|
200
199
|
|
|
201
200
|
const zIndex = useLatestZIndex();
|
|
202
201
|
const wrapperZIndex = useLatestZIndex();
|
|
203
|
-
const
|
|
204
|
-
const
|
|
202
|
+
const actions: IReqorePanelAction[] = useMemo(() => {
|
|
203
|
+
const actions: IReqorePanelAction[] = [];
|
|
205
204
|
|
|
206
205
|
/* Adding a hide/show button to the drawer. */
|
|
207
206
|
if (hidable) {
|
|
208
|
-
|
|
209
|
-
responsive: false,
|
|
207
|
+
actions.push({
|
|
210
208
|
icon: getHideShowIcon(position, _isHidden),
|
|
211
209
|
onClick: () => {
|
|
212
210
|
setIsHidden(!_isHidden);
|
|
@@ -220,15 +218,14 @@ export const ReqoreDrawer = ({
|
|
|
220
218
|
|
|
221
219
|
/* Adding a close button to the drawer. */
|
|
222
220
|
if (onClose) {
|
|
223
|
-
|
|
224
|
-
responsive: false,
|
|
221
|
+
actions.push({
|
|
225
222
|
icon: 'CloseLine',
|
|
226
223
|
onClick: onClose,
|
|
227
224
|
className: 'reqore-drawer-close-button',
|
|
228
225
|
});
|
|
229
226
|
}
|
|
230
227
|
|
|
231
|
-
return
|
|
228
|
+
return actions;
|
|
232
229
|
}, [hidable, position, onClose]);
|
|
233
230
|
|
|
234
231
|
const positions = useMemo(() => {
|
|
@@ -266,27 +263,27 @@ export const ReqoreDrawer = ({
|
|
|
266
263
|
/>
|
|
267
264
|
) : null}
|
|
268
265
|
<Resizable
|
|
269
|
-
className=
|
|
266
|
+
className='reqore-drawer-resizable'
|
|
270
267
|
maxHeight={
|
|
271
268
|
layout === 'horizontal' || layout === 'center' ? maxSize || '90vh' : undefined
|
|
272
269
|
}
|
|
273
270
|
minHeight={
|
|
274
271
|
layout === 'center'
|
|
275
|
-
? '
|
|
272
|
+
? '140px'
|
|
276
273
|
: layout === 'horizontal'
|
|
277
274
|
? _isHidden
|
|
278
275
|
? 0
|
|
279
|
-
: minSize || '
|
|
276
|
+
: minSize || '140px'
|
|
280
277
|
: undefined
|
|
281
278
|
}
|
|
282
279
|
maxWidth={layout === 'vertical' || layout === 'center' ? maxSize || '90vw' : undefined}
|
|
283
280
|
minWidth={
|
|
284
281
|
layout === 'center'
|
|
285
|
-
? '
|
|
282
|
+
? '140px'
|
|
286
283
|
: layout === 'vertical'
|
|
287
284
|
? _isHidden
|
|
288
285
|
? 0
|
|
289
|
-
: minSize || '
|
|
286
|
+
: minSize || '140px'
|
|
290
287
|
: undefined
|
|
291
288
|
}
|
|
292
289
|
as={StyledDrawerResizable}
|
|
@@ -345,19 +342,21 @@ export const ReqoreDrawer = ({
|
|
|
345
342
|
<StyledCloseWrapper
|
|
346
343
|
className='reqore-drawer-controls'
|
|
347
344
|
position={position}
|
|
348
|
-
w={layout === 'vertical' ? 0 : _size.width}
|
|
349
|
-
h={layout === 'horizontal' ? 0 : _size.height}
|
|
345
|
+
w={layout === 'vertical' && _isHidden ? 0 : _size.width}
|
|
346
|
+
h={layout === 'horizontal' && _isHidden ? 0 : _size.height}
|
|
350
347
|
>
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
348
|
+
{hidable && (
|
|
349
|
+
<ReqoreButton
|
|
350
|
+
flat
|
|
351
|
+
customTheme={theme}
|
|
352
|
+
className='reqore-drawer-control reqore-drawer-hide-button'
|
|
353
|
+
icon={getHideShowIcon(position, _isHidden)}
|
|
354
|
+
onClick={() => {
|
|
355
|
+
setIsHidden(!_isHidden);
|
|
356
|
+
onHideToggle && onHideToggle(!_isHidden);
|
|
357
|
+
}}
|
|
358
|
+
/>
|
|
359
|
+
)}
|
|
361
360
|
</StyledCloseWrapper>
|
|
362
361
|
) : null}
|
|
363
362
|
{!_isHidden && (
|
|
@@ -365,12 +364,12 @@ export const ReqoreDrawer = ({
|
|
|
365
364
|
{...rest}
|
|
366
365
|
opacity={opacity}
|
|
367
366
|
blur={hasBackdrop ? 0 : blur}
|
|
368
|
-
actions={
|
|
367
|
+
actions={actions}
|
|
369
368
|
customTheme={customTheme}
|
|
370
369
|
intent={intent}
|
|
371
370
|
rounded={floating || _isModal ? true : false}
|
|
372
371
|
flat={flat}
|
|
373
|
-
className={
|
|
372
|
+
className={`${className || ''} reqore-drawer`}
|
|
374
373
|
style={{
|
|
375
374
|
width: '100%',
|
|
376
375
|
maxHeight: '100%',
|
|
@@ -22,7 +22,6 @@ export interface IReqoreDropdownProps extends Partial<IPopoverOptions> {
|
|
|
22
22
|
caretPosition?: 'left' | 'right';
|
|
23
23
|
isDefaultOpen?: boolean;
|
|
24
24
|
onItemSelect?: TDropdownItemOnClick;
|
|
25
|
-
style?: React.CSSProperties;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
@@ -65,7 +64,7 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
65
64
|
...rest,
|
|
66
65
|
icon: caretPosition === 'left' ? icon || 'ArrowDownSFill' : rightIcon,
|
|
67
66
|
rightIcon: caretPosition === 'right' ? icon || 'ArrowDownSFill' : rightIcon,
|
|
68
|
-
style: buttonStyle
|
|
67
|
+
style: buttonStyle,
|
|
69
68
|
disabled: !size(items),
|
|
70
69
|
className: `${(rest as any)?.className || ''} reqore-dropdown-control`,
|
|
71
70
|
} as T),
|
|
@@ -99,7 +98,6 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
99
98
|
useTargetWidth={useTargetWidth}
|
|
100
99
|
component={component || ReqoreButton}
|
|
101
100
|
componentProps={componentProps}
|
|
102
|
-
isReqoreComponent
|
|
103
101
|
noWrapper
|
|
104
102
|
placement={placement || 'bottom-start'}
|
|
105
103
|
handler={handler || 'click'}
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { memo, useContext } from 'react';
|
|
2
2
|
import { IconContext } from 'react-icons';
|
|
3
3
|
import { IconBaseProps, IconType } from 'react-icons/lib';
|
|
4
4
|
import * as RemixIcons from 'react-icons/ri';
|
|
5
5
|
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
|
-
import {
|
|
8
|
+
import { TReqoreIntent } from '../../constants/theme';
|
|
9
9
|
import { isStringSize } from '../../helpers/utils';
|
|
10
|
-
import {
|
|
11
|
-
import { useTooltip } from '../../hooks/useTooltip';
|
|
12
|
-
import { IReqoreIntent, IWithReqoreEffect, IWithReqoreTooltip } from '../../types/global';
|
|
10
|
+
import { IWithReqoreEffect } from '../../types/global';
|
|
13
11
|
import { IReqoreIconName } from '../../types/icons';
|
|
14
|
-
import { StyledEffect
|
|
12
|
+
import { StyledEffect } from '../Effect';
|
|
15
13
|
|
|
16
|
-
export interface IReqoreIconProps
|
|
17
|
-
extends React.HTMLAttributes<HTMLSpanElement>,
|
|
18
|
-
IWithReqoreEffect,
|
|
19
|
-
IWithReqoreTooltip,
|
|
20
|
-
IReqoreIntent {
|
|
14
|
+
export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement>, IWithReqoreEffect {
|
|
21
15
|
icon?: IReqoreIconName;
|
|
22
|
-
color?:
|
|
16
|
+
color?: string;
|
|
23
17
|
size?: TSizes | string;
|
|
24
18
|
iconProps?: IconBaseProps;
|
|
19
|
+
intent?: TReqoreIntent;
|
|
25
20
|
margin?: 'right' | 'left' | 'both';
|
|
26
21
|
image?: string;
|
|
27
22
|
rounded?: boolean;
|
|
@@ -57,85 +52,71 @@ export const StyledIconWrapper = styled(StyledEffect)<{ margin: 'right' | 'left'
|
|
|
57
52
|
`;
|
|
58
53
|
|
|
59
54
|
const ReqoreIcon = memo(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
) => {
|
|
77
|
-
const { targetRef } = useCombinedRefs(ref);
|
|
78
|
-
const theme = useContext(ReqoreThemeContext);
|
|
79
|
-
const Icon: IconType = RemixIcons[`Ri${icon}`];
|
|
80
|
-
const finalColor: string | undefined = intent
|
|
81
|
-
? theme.intents[intent]
|
|
82
|
-
: getColorFromMaybeString(theme, color);
|
|
83
|
-
const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
|
|
84
|
-
|
|
85
|
-
useTooltip(targetRef.current, tooltip);
|
|
86
|
-
|
|
87
|
-
if (image) {
|
|
88
|
-
return (
|
|
89
|
-
<StyledIconWrapper
|
|
90
|
-
{...rest}
|
|
91
|
-
ref={targetRef}
|
|
92
|
-
size={size}
|
|
93
|
-
margin={margin}
|
|
94
|
-
className={`${className || ''} reqore-icon`}
|
|
95
|
-
style={{ ...style, width: finalSize, height: finalSize }}
|
|
96
|
-
>
|
|
97
|
-
<img src={image} alt='' />
|
|
98
|
-
</StyledIconWrapper>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (!Icon) {
|
|
103
|
-
return (
|
|
104
|
-
<StyledIconWrapper
|
|
105
|
-
{...rest}
|
|
106
|
-
ref={targetRef}
|
|
107
|
-
size={size}
|
|
108
|
-
margin={margin}
|
|
109
|
-
className={`${className || ''} reqore-icon`}
|
|
110
|
-
style={{ ...style, width: finalSize, height: finalSize }}
|
|
111
|
-
/>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
55
|
+
({
|
|
56
|
+
icon,
|
|
57
|
+
size = 'normal',
|
|
58
|
+
className,
|
|
59
|
+
color,
|
|
60
|
+
margin,
|
|
61
|
+
style = {},
|
|
62
|
+
iconProps,
|
|
63
|
+
intent,
|
|
64
|
+
image,
|
|
65
|
+
...rest
|
|
66
|
+
}: IReqoreIconProps) => {
|
|
67
|
+
const theme = useContext(ReqoreThemeContext);
|
|
68
|
+
const Icon: IconType = RemixIcons[`Ri${icon}`];
|
|
69
|
+
const finalColor: string | undefined = intent ? theme.intents[intent] : color;
|
|
70
|
+
const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
|
|
114
71
|
|
|
72
|
+
if (image) {
|
|
115
73
|
return (
|
|
116
74
|
<StyledIconWrapper
|
|
117
75
|
{...rest}
|
|
118
|
-
ref={targetRef}
|
|
119
|
-
margin={margin}
|
|
120
76
|
size={size}
|
|
121
|
-
|
|
77
|
+
margin={margin}
|
|
122
78
|
className={`${className || ''} reqore-icon`}
|
|
79
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
123
80
|
>
|
|
124
|
-
<
|
|
125
|
-
value={{
|
|
126
|
-
color: finalColor || 'inherit',
|
|
127
|
-
size: finalSize,
|
|
128
|
-
style: {
|
|
129
|
-
verticalAlign: 'super',
|
|
130
|
-
},
|
|
131
|
-
}}
|
|
132
|
-
>
|
|
133
|
-
<Icon {...iconProps} />
|
|
134
|
-
</IconContext.Provider>
|
|
81
|
+
<img src={image} alt='' />
|
|
135
82
|
</StyledIconWrapper>
|
|
136
83
|
);
|
|
137
84
|
}
|
|
138
|
-
|
|
85
|
+
|
|
86
|
+
if (!Icon) {
|
|
87
|
+
return (
|
|
88
|
+
<StyledIconWrapper
|
|
89
|
+
{...rest}
|
|
90
|
+
size={size}
|
|
91
|
+
margin={margin}
|
|
92
|
+
className={`${className || ''} reqore-icon`}
|
|
93
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<StyledIconWrapper
|
|
100
|
+
{...rest}
|
|
101
|
+
margin={margin}
|
|
102
|
+
size={size}
|
|
103
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
104
|
+
className={`${className || ''} reqore-icon`}
|
|
105
|
+
>
|
|
106
|
+
<IconContext.Provider
|
|
107
|
+
value={{
|
|
108
|
+
color: finalColor || 'inherit',
|
|
109
|
+
size: finalSize,
|
|
110
|
+
style: {
|
|
111
|
+
verticalAlign: 'super',
|
|
112
|
+
},
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
<Icon {...iconProps} />
|
|
116
|
+
</IconContext.Provider>
|
|
117
|
+
</StyledIconWrapper>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
139
120
|
);
|
|
140
121
|
|
|
141
122
|
export default ReqoreIcon;
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
IWithReqoreEffect,
|
|
23
23
|
} from '../../types/global';
|
|
24
24
|
import { IReqoreIconName } from '../../types/icons';
|
|
25
|
-
import { StyledEffect
|
|
25
|
+
import { StyledEffect } from '../Effect';
|
|
26
26
|
import ReqoreIcon from '../Icon';
|
|
27
27
|
import ReqoreInputClearButton from '../InputClearButton';
|
|
28
28
|
|
|
@@ -48,7 +48,6 @@ export interface IReqoreInputProps
|
|
|
48
48
|
rounded?: boolean;
|
|
49
49
|
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url';
|
|
50
50
|
wrapperStyle?: React.CSSProperties;
|
|
51
|
-
iconColor?: TReqoreEffectColor;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
@@ -60,10 +59,8 @@ export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
|
60
59
|
|
|
61
60
|
export const StyledInputWrapper = styled.div<IReqoreInputStyle>`
|
|
62
61
|
height: ${({ _size }) => SIZE_TO_PX[_size]}px;
|
|
63
|
-
width: ${({ width
|
|
64
|
-
|
|
65
|
-
min-width: 60px;
|
|
66
|
-
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 1 auto')};
|
|
62
|
+
width: ${({ width }) => (width ? `${width}px` : 'auto')};
|
|
63
|
+
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 0 auto' : '0 0 auto')};
|
|
67
64
|
font-size: ${({ _size }) => TEXT_FROM_SIZE[_size]}px;
|
|
68
65
|
position: relative;
|
|
69
66
|
overflow: hidden;
|
|
@@ -153,7 +150,6 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
153
150
|
className,
|
|
154
151
|
onClearClick,
|
|
155
152
|
icon,
|
|
156
|
-
iconColor,
|
|
157
153
|
flat,
|
|
158
154
|
rounded = true,
|
|
159
155
|
minimal,
|
|
@@ -189,7 +185,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
189
185
|
>
|
|
190
186
|
{icon && (
|
|
191
187
|
<StyledIconWrapper _size={size}>
|
|
192
|
-
<ReqoreIcon size={size} icon={icon}
|
|
188
|
+
<ReqoreIcon size={size} icon={icon} />
|
|
193
189
|
</StyledIconWrapper>
|
|
194
190
|
)}
|
|
195
191
|
<StyledInput
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isString } from 'lodash';
|
|
2
2
|
import { rgba } from 'polished';
|
|
3
|
-
import React, { MutableRefObject,
|
|
3
|
+
import React, { MutableRefObject, useContext, useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { usePopper } from 'react-popper';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import { RADIUS_FROM_SIZE } from '../../constants/sizes';
|
|
@@ -62,8 +62,8 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
|
62
62
|
max-height: ${({ maxHeight = '80vh' }) => maxHeight};
|
|
63
63
|
z-index: 999999;
|
|
64
64
|
border-radius: ${RADIUS_FROM_SIZE.normal}px;
|
|
65
|
-
border: ${({ flat,
|
|
66
|
-
!flat &&
|
|
65
|
+
border: ${({ flat, isString, ...rest }: any) =>
|
|
66
|
+
!flat && !isString ? `1px solid ${getPopoverArrowColor({ ...rest, flat })}` : undefined};
|
|
67
67
|
|
|
68
68
|
${({ transparent }) =>
|
|
69
69
|
!transparent &&
|
|
@@ -129,7 +129,7 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
|
129
129
|
}
|
|
130
130
|
`;
|
|
131
131
|
|
|
132
|
-
const StyledPopoverContent = styled.div
|
|
132
|
+
const StyledPopoverContent = styled.div<{ isString?: boolean }>`
|
|
133
133
|
width: 100%;
|
|
134
134
|
height: 100%;
|
|
135
135
|
z-index: 20;
|
|
@@ -139,138 +139,133 @@ const StyledPopoverContent = styled.div`
|
|
|
139
139
|
|
|
140
140
|
export interface IReqoreInternalPopoverProps extends IPopoverData {}
|
|
141
141
|
|
|
142
|
-
const InternalPopover: React.FC<IReqoreInternalPopoverProps> =
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
143
|
+
targetElement,
|
|
144
|
+
content,
|
|
145
|
+
id,
|
|
146
|
+
placement,
|
|
147
|
+
noArrow,
|
|
148
|
+
useTargetWidth,
|
|
149
|
+
transparent,
|
|
150
|
+
maxWidth,
|
|
151
|
+
maxHeight,
|
|
152
|
+
blur,
|
|
153
|
+
intent,
|
|
154
|
+
title,
|
|
155
|
+
icon,
|
|
156
|
+
minimal,
|
|
157
|
+
flat = true,
|
|
158
|
+
effect,
|
|
159
|
+
}) => {
|
|
160
|
+
const { removePopover, updatePopover, uiScale } = useContext(PopoverContext);
|
|
161
|
+
const [popperElement, setPopperElement] = useState(null);
|
|
162
|
+
const [arrowElement, setArrowElement] = useState(null);
|
|
163
|
+
const popperRef: MutableRefObject<any> = useRef(null);
|
|
164
|
+
const { styles, attributes } = usePopper(targetElement, popperElement, {
|
|
147
165
|
placement,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
maxHeight,
|
|
154
|
-
blur,
|
|
155
|
-
intent,
|
|
156
|
-
title,
|
|
157
|
-
icon,
|
|
158
|
-
minimal,
|
|
159
|
-
flat = true,
|
|
160
|
-
effect,
|
|
161
|
-
}) => {
|
|
162
|
-
const { removePopover, updatePopover, uiScale } = useContext(PopoverContext);
|
|
163
|
-
const [popperElement, setPopperElement] = useState(null);
|
|
164
|
-
const [arrowElement, setArrowElement] = useState(null);
|
|
165
|
-
const popperRef: MutableRefObject<any> = useRef(null);
|
|
166
|
-
const { styles, attributes } = usePopper(targetElement, popperElement, {
|
|
167
|
-
placement,
|
|
168
|
-
modifiers: [
|
|
169
|
-
{
|
|
170
|
-
name: 'offset',
|
|
171
|
-
options: {
|
|
172
|
-
offset: [0, noArrow ? 5 : 10],
|
|
173
|
-
},
|
|
166
|
+
modifiers: [
|
|
167
|
+
{
|
|
168
|
+
name: 'offset',
|
|
169
|
+
options: {
|
|
170
|
+
offset: [0, noArrow ? 5 : 10],
|
|
174
171
|
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'arrow',
|
|
175
|
+
options: {
|
|
176
|
+
element: arrowElement,
|
|
180
177
|
},
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'hide',
|
|
181
|
+
enabled: true,
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
});
|
|
187
185
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
if (popperRef.current) {
|
|
188
|
+
updatePopover?.(id, { popperRef });
|
|
189
|
+
}
|
|
190
|
+
}, [popperRef]);
|
|
193
191
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
if (attributes.popper?.['data-popper-reference-hidden']) {
|
|
194
|
+
removePopover?.(id);
|
|
195
|
+
}
|
|
196
|
+
}, [attributes.popper]);
|
|
199
197
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return parseInt(axis, 10);
|
|
213
|
-
});
|
|
198
|
+
/* Getting the x and y values from the transform property of the popper element. */
|
|
199
|
+
const translateValues = styles.popper.transform
|
|
200
|
+
?.replace('translate3d(', '')
|
|
201
|
+
.replace('translate(', '')
|
|
202
|
+
.replace(')', '')
|
|
203
|
+
.split(',')
|
|
204
|
+
.map((axis) => {
|
|
205
|
+
if (uiScale || uiScale === 0) {
|
|
206
|
+
return parseInt(axis, 10) < 0 ? parseInt(axis, 10) * uiScale : parseInt(axis, 10) / uiScale;
|
|
207
|
+
}
|
|
208
|
+
return parseInt(axis, 10);
|
|
209
|
+
});
|
|
214
210
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
);
|
|
211
|
+
return (
|
|
212
|
+
<ReqoreThemeProvider>
|
|
213
|
+
{blur > 0 ? <StyledBackdrop zIndex={999998} blur={blur} closable /> : null}
|
|
214
|
+
<StyledPopoverWrapper
|
|
215
|
+
maxWidth={maxWidth}
|
|
216
|
+
maxHeight={maxHeight}
|
|
217
|
+
transparent={transparent}
|
|
218
|
+
effect={effect}
|
|
219
|
+
isOpaque={!transparent && !minimal}
|
|
220
|
+
intent={intent}
|
|
221
|
+
flat={flat}
|
|
222
|
+
isString={isString(content)}
|
|
223
|
+
dim={flat && !transparent && !effect && minimal}
|
|
224
|
+
className='reqore-popover-content'
|
|
225
|
+
ref={(el) => {
|
|
226
|
+
setPopperElement(el);
|
|
227
|
+
popperRef.current = el;
|
|
228
|
+
}}
|
|
229
|
+
style={{
|
|
230
|
+
...styles.popper,
|
|
231
|
+
transform: `translate(${translateValues?.[0] || 0}px, ${translateValues?.[1] || 0}px)`,
|
|
232
|
+
width: useTargetWidth && (targetElement?.getBoundingClientRect()?.width || undefined),
|
|
233
|
+
}}
|
|
234
|
+
{...attributes.popper}
|
|
235
|
+
>
|
|
236
|
+
{!noArrow && !transparent ? (
|
|
237
|
+
<StyledPopoverArrow ref={setArrowElement} style={styles.arrow} data-popper-arrow />
|
|
238
|
+
) : null}
|
|
239
|
+
<StyledPopoverContent isString={isString(content)}>
|
|
240
|
+
{isString(content) ? (
|
|
241
|
+
<ReqoreMessage
|
|
242
|
+
opaque={!transparent && !minimal}
|
|
243
|
+
className='reqore-popover-text'
|
|
244
|
+
intent={intent}
|
|
245
|
+
title={title}
|
|
246
|
+
icon={icon}
|
|
247
|
+
minimal={transparent}
|
|
248
|
+
flat={flat || transparent}
|
|
249
|
+
effect={effect}
|
|
250
|
+
>
|
|
251
|
+
{content}
|
|
252
|
+
</ReqoreMessage>
|
|
253
|
+
) : (
|
|
254
|
+
<>
|
|
255
|
+
{React.Children.map(content, (child) =>
|
|
256
|
+
child
|
|
257
|
+
? React.cloneElement(child, {
|
|
258
|
+
_insidePopover: true,
|
|
259
|
+
_popoverId: id,
|
|
260
|
+
})
|
|
261
|
+
: null
|
|
262
|
+
)}
|
|
263
|
+
</>
|
|
264
|
+
)}
|
|
265
|
+
</StyledPopoverContent>
|
|
266
|
+
</StyledPopoverWrapper>
|
|
267
|
+
</ReqoreThemeProvider>
|
|
268
|
+
);
|
|
269
|
+
};
|
|
275
270
|
|
|
276
271
|
export default InternalPopover;
|