@qoretechnologies/reqore 0.28.4 → 0.28.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/__tests__/button.test.tsx +45 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +5 -5
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts +3 -2
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +28 -24
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +2 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +8 -8
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +1 -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/Icon/index.d.ts +12 -2
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +35 -4
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +28 -34
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Menu/divider.d.ts +2 -0
- package/dist/components/Menu/divider.d.ts.map +1 -1
- package/dist/components/Menu/divider.js +40 -7
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Message/index.d.ts +3 -2
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +3 -3
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +11 -8
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Panel/index.d.ts +1 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +6 -6
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/RadioGroup/index.d.ts +8 -6
- package/dist/components/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/RadioGroup/index.js +6 -12
- package/dist/components/RadioGroup/index.js.map +1 -1
- package/dist/components/Tag/group.d.ts +2 -1
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +7 -3
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/constants/sizes.d.ts +7 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +8 -1
- package/dist/constants/sizes.js.map +1 -1
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +1 -2
- package/dist/helpers/colors.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +6 -2
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +8 -5
- package/src/components/Checkbox/index.tsx +58 -30
- package/src/components/ControlGroup/index.tsx +10 -4
- package/src/components/Dropdown/index.tsx +2 -2
- package/src/components/Icon/index.tsx +75 -1
- package/src/components/InternalPopover/index.tsx +105 -47
- package/src/components/Menu/divider.tsx +20 -3
- package/src/components/Message/index.tsx +3 -0
- package/src/components/Notifications/notification.tsx +23 -13
- package/src/components/Panel/index.tsx +14 -10
- package/src/components/RadioGroup/index.tsx +36 -27
- package/src/components/Tag/group.tsx +5 -2
- package/src/constants/sizes.ts +8 -0
- package/src/helpers/colors.ts +2 -4
- package/src/hooks/usePopover.tsx +15 -2
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +7 -1
- package/src/stories/Icon/Icon.stories.tsx +99 -22
- package/src/stories/Message/Message.stories.tsx +7 -1
- package/src/stories/Panel/Panel.stories.tsx +3 -3
- package/src/stories/Popover/Popover.stories.tsx +91 -12
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +29 -2
- package/src/stories/Tag/Tag.stories.tsx +4 -2
- package/src/stories/utils/args.ts +13 -0
- package/tests.json +1 -1
|
@@ -15,7 +15,7 @@ import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
|
15
15
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
16
16
|
import { fadeIn } from '../../helpers/animations';
|
|
17
17
|
import { changeLightness, getNotificationIntent, getReadableColor } from '../../helpers/colors';
|
|
18
|
-
import { IWithReqoreEffect, IWithReqoreMinimal } from '../../types/global';
|
|
18
|
+
import { IWithReqoreEffect, IWithReqoreMinimal, IWithReqoreOpaque } from '../../types/global';
|
|
19
19
|
import { IReqoreIconName } from '../../types/icons';
|
|
20
20
|
import { StyledEffect } from '../Effect';
|
|
21
21
|
import { ReqoreHeading } from '../Header';
|
|
@@ -23,7 +23,10 @@ import ReqoreIcon from '../Icon';
|
|
|
23
23
|
|
|
24
24
|
export type IReqoreNotificationType = TReqoreIntent;
|
|
25
25
|
|
|
26
|
-
export interface IReqoreNotificationProps
|
|
26
|
+
export interface IReqoreNotificationProps
|
|
27
|
+
extends IWithReqoreEffect,
|
|
28
|
+
IWithReqoreMinimal,
|
|
29
|
+
IWithReqoreOpaque {
|
|
27
30
|
type?: IReqoreNotificationType;
|
|
28
31
|
intent?: TReqoreIntent;
|
|
29
32
|
title?: string;
|
|
@@ -38,7 +41,7 @@ export interface IReqoreNotificationProps extends IWithReqoreEffect, IWithReqore
|
|
|
38
41
|
size?: TSizes;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
export interface IReqoreNotificationStyle {
|
|
44
|
+
export interface IReqoreNotificationStyle extends IWithReqoreOpaque {
|
|
42
45
|
theme: IReqoreTheme;
|
|
43
46
|
type?: IReqoreNotificationType;
|
|
44
47
|
clickable?: boolean;
|
|
@@ -73,12 +76,14 @@ export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotification
|
|
|
73
76
|
transition: all 0.2s ease-out;
|
|
74
77
|
|
|
75
78
|
// Do not fade in the component if it's a message
|
|
76
|
-
${({ asMessage }) =>
|
|
77
|
-
asMessage
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
${({ asMessage }) => {
|
|
80
|
+
if (asMessage) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
return css`
|
|
84
|
+
animation: 0.2s ${fadeIn} ease-in;
|
|
85
|
+
`;
|
|
86
|
+
}}
|
|
82
87
|
|
|
83
88
|
&:not(:first-child) {
|
|
84
89
|
margin-top: ${({ asMessage }) => (asMessage ? undefined : `10px`)};
|
|
@@ -93,12 +98,15 @@ export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotification
|
|
|
93
98
|
hasShadow,
|
|
94
99
|
flat,
|
|
95
100
|
minimal,
|
|
101
|
+
opaque,
|
|
96
102
|
}: IReqoreNotificationStyle) => css`
|
|
97
103
|
background-color: ${minimal
|
|
98
104
|
? 'transparent'
|
|
105
|
+
: opaque
|
|
106
|
+
? changeLightness(theme.main, 0.1)
|
|
99
107
|
: rgba(getNotificationIntent(theme, intent || type), 0.3)};
|
|
100
108
|
border: ${flat ? 0 : '1px solid'};
|
|
101
|
-
border-color: ${getNotificationIntent(theme, intent || type)};
|
|
109
|
+
border-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.2)};
|
|
102
110
|
|
|
103
111
|
${hasShadow &&
|
|
104
112
|
css`
|
|
@@ -113,13 +121,13 @@ export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotification
|
|
|
113
121
|
display: block;
|
|
114
122
|
top: 0;
|
|
115
123
|
height: 3px;
|
|
116
|
-
background-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.
|
|
124
|
+
background-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.2)};
|
|
117
125
|
animation-name: ${timeoutAnimation};
|
|
118
126
|
animation-duration: ${timeout}ms;
|
|
119
127
|
}
|
|
120
128
|
`}
|
|
121
129
|
|
|
122
|
-
color: ${getReadableColor(theme, null, null, true, theme.originalMain)};
|
|
130
|
+
color: ${getReadableColor(theme, null, null, true, !opaque ? theme.originalMain : undefined)};
|
|
123
131
|
|
|
124
132
|
${clickable &&
|
|
125
133
|
css`
|
|
@@ -129,7 +137,7 @@ export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotification
|
|
|
129
137
|
getNotificationIntent(theme, intent || type),
|
|
130
138
|
minimal ? 0.2 : 0.5
|
|
131
139
|
)};
|
|
132
|
-
border-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.
|
|
140
|
+
border-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.25)};
|
|
133
141
|
}
|
|
134
142
|
`}
|
|
135
143
|
`}
|
|
@@ -218,6 +226,7 @@ const ReqoreNotification = forwardRef<HTMLDivElement, IReqoreNotificationProps>(
|
|
|
218
226
|
onFinish,
|
|
219
227
|
flat,
|
|
220
228
|
minimal,
|
|
229
|
+
opaque,
|
|
221
230
|
size = 'normal',
|
|
222
231
|
},
|
|
223
232
|
ref: any
|
|
@@ -273,6 +282,7 @@ const ReqoreNotification = forwardRef<HTMLDivElement, IReqoreNotificationProps>(
|
|
|
273
282
|
ref={ref}
|
|
274
283
|
style={styles}
|
|
275
284
|
size={size}
|
|
285
|
+
opaque={opaque}
|
|
276
286
|
>
|
|
277
287
|
{type || intent || icon ? (
|
|
278
288
|
<StyledIconWrapper type={type || intent} size={size}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { size } from 'lodash';
|
|
2
2
|
import { darken, rgba } from 'polished';
|
|
3
|
-
import {
|
|
3
|
+
import { forwardRef, ReactElement, useCallback, useMemo, useState } from 'react';
|
|
4
4
|
import { useUpdateEffect } from 'react-use';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import {
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
PADDING_FROM_SIZE,
|
|
9
9
|
RADIUS_FROM_SIZE,
|
|
10
10
|
TEXT_FROM_SIZE,
|
|
11
|
-
TSizes
|
|
11
|
+
TSizes
|
|
12
12
|
} from '../../constants/sizes';
|
|
13
13
|
import { IReqoreTheme } from '../../constants/theme';
|
|
14
14
|
import {
|
|
15
15
|
changeDarkness,
|
|
16
16
|
changeLightness,
|
|
17
17
|
getMainBackgroundColor,
|
|
18
|
-
getReadableColor
|
|
18
|
+
getReadableColor
|
|
19
19
|
} from '../../helpers/colors';
|
|
20
20
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
21
21
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
IWithReqoreCustomTheme,
|
|
27
27
|
IWithReqoreFlat,
|
|
28
28
|
IWithReqoreSize,
|
|
29
|
-
IWithReqoreTooltip
|
|
29
|
+
IWithReqoreTooltip
|
|
30
30
|
} from '../../types/global';
|
|
31
31
|
import { IReqoreIconName } from '../../types/icons';
|
|
32
32
|
import ReqoreButton, { ButtonBadge, IReqoreButtonProps, TReqoreBadge } from '../Button';
|
|
@@ -86,6 +86,7 @@ export interface IReqorePanelProps
|
|
|
86
86
|
contentSize?: TSizes;
|
|
87
87
|
contentEffect?: IReqoreEffect;
|
|
88
88
|
headerEffect?: IReqoreEffect;
|
|
89
|
+
transparent?: boolean;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
export interface IStyledPanel extends IReqorePanelProps {
|
|
@@ -133,7 +134,7 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
|
|
|
133
134
|
: `${rgba(
|
|
134
135
|
changeLightness(
|
|
135
136
|
intent ? theme.intents[intent] : getMainBackgroundColor(theme),
|
|
136
|
-
0.
|
|
137
|
+
0.25
|
|
137
138
|
),
|
|
138
139
|
opacity
|
|
139
140
|
)}`};
|
|
@@ -417,6 +418,8 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
417
418
|
return newContentEffect;
|
|
418
419
|
}, [intent, theme, contentEffect, interactive]);
|
|
419
420
|
|
|
421
|
+
const opacity = rest.transparent ? 0 : rest.opacity;
|
|
422
|
+
|
|
420
423
|
return (
|
|
421
424
|
<StyledPanel
|
|
422
425
|
{...rest}
|
|
@@ -430,6 +433,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
430
433
|
interactive={interactive}
|
|
431
434
|
theme={theme}
|
|
432
435
|
effect={transformedContentEffect}
|
|
436
|
+
opacity={opacity}
|
|
433
437
|
>
|
|
434
438
|
{hasTitleBar && (
|
|
435
439
|
<StyledPanelTitle
|
|
@@ -440,8 +444,8 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
440
444
|
onClick={handleCollapseClick}
|
|
441
445
|
theme={theme}
|
|
442
446
|
contentSize={contentSize}
|
|
443
|
-
opacity={
|
|
444
|
-
noHorizontalPadding={
|
|
447
|
+
opacity={opacity ?? (minimal ? 0 : 1)}
|
|
448
|
+
noHorizontalPadding={opacity === 0}
|
|
445
449
|
>
|
|
446
450
|
<StyledPanelTitleHeader>
|
|
447
451
|
{icon && (
|
|
@@ -509,7 +513,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
509
513
|
padded={padded}
|
|
510
514
|
minimal={minimal}
|
|
511
515
|
contentSize={contentSize}
|
|
512
|
-
noHorizontalPadding={
|
|
516
|
+
noHorizontalPadding={opacity === 0}
|
|
513
517
|
>
|
|
514
518
|
{children}
|
|
515
519
|
</StyledPanelContent>
|
|
@@ -519,8 +523,8 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
519
523
|
flat={flat}
|
|
520
524
|
className='reqore-panel-bottom-actions'
|
|
521
525
|
theme={theme}
|
|
522
|
-
opacity={
|
|
523
|
-
noHorizontalPadding={
|
|
526
|
+
opacity={opacity ?? (minimal ? 0 : 1)}
|
|
527
|
+
noHorizontalPadding={opacity === 0}
|
|
524
528
|
>
|
|
525
529
|
<ReqoreControlGroup>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
526
530
|
<ReqoreControlGroup>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReqoreCheckbox, ReqoreControlGroup } from '../..';
|
|
3
|
+
import { TSizes } from '../../constants/sizes';
|
|
4
|
+
import { IReqoreCheckboxProps } from '../Checkbox';
|
|
5
|
+
import { IReqoreControlGroupProps } from '../ControlGroup';
|
|
6
|
+
import ReqoreMenuDivider from '../Menu/divider';
|
|
6
7
|
|
|
7
8
|
export interface IReqoreRadioGroupItem extends IReqoreCheckboxProps {
|
|
8
|
-
value
|
|
9
|
+
value?: string;
|
|
10
|
+
divider?: boolean;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export interface IReqoreRadioGroupProps
|
|
12
|
-
extends
|
|
14
|
+
extends Omit<IReqoreControlGroupProps, 'children'>,
|
|
15
|
+
Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
13
16
|
items: IReqoreRadioGroupItem[];
|
|
14
17
|
selected?: string;
|
|
15
18
|
onSelectClick?: (value: string) => void;
|
|
@@ -18,11 +21,6 @@ export interface IReqoreRadioGroupProps
|
|
|
18
21
|
asSwitch?: boolean;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
const StyledRadioGroup = styled.div`
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-flow: column;
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
24
|
const ReqoreRadioGroup = ({
|
|
27
25
|
items = [],
|
|
28
26
|
selected,
|
|
@@ -30,23 +28,34 @@ const ReqoreRadioGroup = ({
|
|
|
30
28
|
size,
|
|
31
29
|
disabled,
|
|
32
30
|
asSwitch,
|
|
31
|
+
vertical = true,
|
|
33
32
|
...rest
|
|
34
33
|
}: IReqoreRadioGroupProps) => (
|
|
35
|
-
<
|
|
36
|
-
{items.map(({ value, ...itemRest }) =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
<ReqoreControlGroup {...rest} vertical={vertical}>
|
|
35
|
+
{items.map(({ value, divider, ...itemRest }) =>
|
|
36
|
+
divider ? (
|
|
37
|
+
<ReqoreMenuDivider
|
|
38
|
+
{...itemRest}
|
|
39
|
+
size={size || itemRest.size}
|
|
40
|
+
effect={{ ...itemRest.effect, textAlign: 'left' }}
|
|
41
|
+
margin='left'
|
|
42
|
+
label={vertical ? itemRest.label : undefined}
|
|
43
|
+
/>
|
|
44
|
+
) : (
|
|
45
|
+
<ReqoreCheckbox
|
|
46
|
+
asSwitch={asSwitch}
|
|
47
|
+
{...itemRest}
|
|
48
|
+
key={value}
|
|
49
|
+
checked={value === selected}
|
|
50
|
+
size={size || itemRest.size}
|
|
51
|
+
disabled={disabled || itemRest.disabled}
|
|
52
|
+
onClick={() => {
|
|
53
|
+
onSelectClick(value);
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
)}
|
|
58
|
+
</ReqoreControlGroup>
|
|
50
59
|
);
|
|
51
60
|
|
|
52
61
|
export default ReqoreRadioGroup;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { StyledTag } from '.';
|
|
4
|
-
import { TSizes } from '../../constants/sizes';
|
|
4
|
+
import { GAP_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
5
5
|
|
|
6
6
|
export interface IReqoreTagGroup extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
children: any;
|
|
8
8
|
size?: TSizes;
|
|
9
|
+
gapSize?: TSizes;
|
|
9
10
|
columns?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
10
11
|
hasBottomMargin?: boolean;
|
|
11
12
|
}
|
|
@@ -15,7 +16,7 @@ const StyledTagGroup = styled.div`
|
|
|
15
16
|
|
|
16
17
|
${StyledTag} {
|
|
17
18
|
&:not(:last-child) {
|
|
18
|
-
margin-right:
|
|
19
|
+
margin-right: ${({ gapSize }: IReqoreTagGroup) => `${GAP_FROM_SIZE[gapSize]}px`};
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
margin-bottom: ${({ hasBottomMargin }) => (hasBottomMargin ? '5px' : '0px')};
|
|
@@ -25,6 +26,7 @@ const StyledTagGroup = styled.div`
|
|
|
25
26
|
const ReqoreTagGroup = ({
|
|
26
27
|
children,
|
|
27
28
|
size,
|
|
29
|
+
gapSize = 'normal',
|
|
28
30
|
className,
|
|
29
31
|
columns,
|
|
30
32
|
hasBottomMargin = true,
|
|
@@ -32,6 +34,7 @@ const ReqoreTagGroup = ({
|
|
|
32
34
|
}: IReqoreTagGroup) => (
|
|
33
35
|
<StyledTagGroup
|
|
34
36
|
{...rest}
|
|
37
|
+
gapSize={gapSize}
|
|
35
38
|
hasBottomMargin={hasBottomMargin}
|
|
36
39
|
className={`${className || ''} reqore-tag-group`}
|
|
37
40
|
>
|
package/src/constants/sizes.ts
CHANGED
package/src/helpers/colors.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cloneDeep, merge } from 'lodash';
|
|
2
|
-
import { darken, lighten, readableColor } from 'polished';
|
|
2
|
+
import { darken, getLuminance, lighten, readableColor } from 'polished';
|
|
3
3
|
import { TReqoreEffectColor, TReqoreEffectColorList, TReqoreHexColor } from '../components/Effect';
|
|
4
4
|
import { Colors } from '../constants/colors';
|
|
5
5
|
import { DEFAULT_INTENTS, IReqoreTheme, TReqoreIntent } from '../constants/theme';
|
|
@@ -46,9 +46,7 @@ export const percentToHexAlpha = (p: number) => {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
export const shouldDarken = (mainColor: TReqoreHexColor): boolean => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return contrast === '#000000';
|
|
49
|
+
return getLuminance(mainColor) > 0.2;
|
|
52
50
|
};
|
|
53
51
|
|
|
54
52
|
export const getMainColor: (theme: IReqoreTheme, component: string) => TReqoreHexColor = (
|
package/src/hooks/usePopover.tsx
CHANGED
|
@@ -3,6 +3,13 @@ import { MutableRefObject, useContext, useEffect, useMemo, useRef } from 'react'
|
|
|
3
3
|
import { useUnmount, useUpdateEffect } from 'react-use';
|
|
4
4
|
import shortid from 'shortid';
|
|
5
5
|
import PopoverContext from '../context/PopoverContext';
|
|
6
|
+
import {
|
|
7
|
+
IReqoreIntent,
|
|
8
|
+
IWithReqoreEffect,
|
|
9
|
+
IWithReqoreFlat,
|
|
10
|
+
IWithReqoreMinimal,
|
|
11
|
+
} from '../types/global';
|
|
12
|
+
import { IReqoreIconName } from '../types/icons';
|
|
6
13
|
|
|
7
14
|
const startEvents = {
|
|
8
15
|
hover: 'mouseenter',
|
|
@@ -18,7 +25,11 @@ const endEvents = {
|
|
|
18
25
|
focus: null,
|
|
19
26
|
};
|
|
20
27
|
|
|
21
|
-
export interface IPopover
|
|
28
|
+
export interface IPopover
|
|
29
|
+
extends IReqoreIntent,
|
|
30
|
+
IWithReqoreMinimal,
|
|
31
|
+
IWithReqoreEffect,
|
|
32
|
+
IWithReqoreFlat {
|
|
22
33
|
content?: JSX.Element | string | undefined;
|
|
23
34
|
handler?: 'hover' | 'click' | 'focus' | 'hoverStay';
|
|
24
35
|
placement?: Placement;
|
|
@@ -30,9 +41,11 @@ export interface IPopover {
|
|
|
30
41
|
closeOnAnyClick?: boolean;
|
|
31
42
|
delay?: number;
|
|
32
43
|
blur?: number;
|
|
33
|
-
|
|
44
|
+
transparent?: boolean;
|
|
34
45
|
maxWidth?: string;
|
|
35
46
|
maxHeight?: string;
|
|
47
|
+
icon?: IReqoreIconName;
|
|
48
|
+
title?: string;
|
|
36
49
|
}
|
|
37
50
|
|
|
38
51
|
export interface IPopoverOptions extends IPopover {
|
|
@@ -2,7 +2,7 @@ import { Meta, Story } from '@storybook/react/types-6-0';
|
|
|
2
2
|
import { IReqoreControlGroupProps } from '../../components/ControlGroup';
|
|
3
3
|
import ReqoreInput from '../../components/Input';
|
|
4
4
|
import { ReqoreButton, ReqoreControlGroup, ReqoreTag } from '../../index';
|
|
5
|
-
import { MinimalArg, SizeArg, argManager } from '../utils/args';
|
|
5
|
+
import { GapSizeArg, MinimalArg, SizeArg, argManager } from '../utils/args';
|
|
6
6
|
|
|
7
7
|
const { createArg } = argManager<IReqoreControlGroupProps>();
|
|
8
8
|
|
|
@@ -10,6 +10,7 @@ export default {
|
|
|
10
10
|
title: 'Components/Control Group',
|
|
11
11
|
argTypes: {
|
|
12
12
|
...SizeArg,
|
|
13
|
+
...GapSizeArg,
|
|
13
14
|
...MinimalArg(),
|
|
14
15
|
...createArg('stack', {
|
|
15
16
|
name: 'Stack',
|
|
@@ -68,3 +69,8 @@ export const Stacked = Template.bind({});
|
|
|
68
69
|
Stacked.args = {
|
|
69
70
|
stack: true,
|
|
70
71
|
};
|
|
72
|
+
|
|
73
|
+
export const BigGapSize = Template.bind({});
|
|
74
|
+
BigGapSize.args = {
|
|
75
|
+
gapSize: 'big',
|
|
76
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
2
|
import { IReqoreIconProps } from '../../components/Icon';
|
|
3
|
-
import { ReqoreIcon } from '../../index';
|
|
3
|
+
import { ReqoreIcon, ReqorePanel } from '../../index';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Components/Icon',
|
|
@@ -9,27 +9,104 @@ export default {
|
|
|
9
9
|
export const Icon: Story<IReqoreIconProps> = () => {
|
|
10
10
|
return (
|
|
11
11
|
<>
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
<ReqorePanel label='Basic' flat minimal>
|
|
13
|
+
<ReqoreIcon icon='AccountCircleLine' size='12px' margin='both' />
|
|
14
|
+
<ReqoreIcon icon='4KFill' size='14px' margin='both' />
|
|
15
|
+
<ReqoreIcon icon='ArrowLeftCircleFill' intent='success' margin='both' />
|
|
16
|
+
<ReqoreIcon icon='HotelFill' size='18px' margin='both' />
|
|
17
|
+
<ReqoreIcon icon='SignalTowerFill' size='20px' color='#ff0000' margin='both' />
|
|
18
|
+
<ReqoreIcon icon='SignalTowerFill' size='20px' color='#291133' sepia margin='both' />
|
|
19
|
+
<ReqoreIcon icon='SignalTowerFill' size='20px' color='#0c7052' blur={1} margin='both' />
|
|
20
|
+
<ReqoreIcon
|
|
21
|
+
icon='SignalTowerFill'
|
|
22
|
+
size='20px'
|
|
23
|
+
color='#700c57'
|
|
24
|
+
contrast={150}
|
|
25
|
+
margin='both'
|
|
26
|
+
/>
|
|
27
|
+
<ReqoreIcon icon='SignalTowerFill' size='20px' color='#d5be0f' grayscale margin='both' />
|
|
28
|
+
<ReqoreIcon icon='SignalTowerFill' size='20px' color='#0f5bd5' invert margin='both' />
|
|
29
|
+
<ReqoreIcon
|
|
30
|
+
icon='SignalTowerFill'
|
|
31
|
+
size='20px'
|
|
32
|
+
color='#ffffff'
|
|
33
|
+
opacity={0.5}
|
|
34
|
+
margin='both'
|
|
35
|
+
/>
|
|
36
|
+
</ReqorePanel>
|
|
37
|
+
<br />
|
|
38
|
+
<ReqorePanel label='Image' flat minimal>
|
|
39
|
+
<ReqoreIcon
|
|
40
|
+
image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
|
|
41
|
+
size='20px'
|
|
42
|
+
margin='both'
|
|
43
|
+
/>
|
|
44
|
+
<ReqoreIcon
|
|
45
|
+
image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
|
|
46
|
+
size='40px'
|
|
47
|
+
rounded
|
|
48
|
+
margin='both'
|
|
49
|
+
/>
|
|
50
|
+
<ReqoreIcon
|
|
51
|
+
image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
|
|
52
|
+
size='30px'
|
|
53
|
+
sepia
|
|
54
|
+
margin='both'
|
|
55
|
+
/>
|
|
56
|
+
<ReqoreIcon
|
|
57
|
+
image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
|
|
58
|
+
size='40px'
|
|
59
|
+
blur={3}
|
|
60
|
+
margin='both'
|
|
61
|
+
/>
|
|
62
|
+
<ReqoreIcon
|
|
63
|
+
image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
|
|
64
|
+
size='70px'
|
|
65
|
+
contrast={150}
|
|
66
|
+
margin='both'
|
|
67
|
+
/>
|
|
68
|
+
<ReqoreIcon
|
|
69
|
+
image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
|
|
70
|
+
size='40px'
|
|
71
|
+
brightness={150}
|
|
72
|
+
margin='both'
|
|
73
|
+
/>
|
|
74
|
+
<ReqoreIcon
|
|
75
|
+
image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
|
|
76
|
+
size='40px'
|
|
77
|
+
opacity={0.5}
|
|
78
|
+
margin='both'
|
|
79
|
+
/>
|
|
80
|
+
<ReqoreIcon
|
|
81
|
+
image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
|
|
82
|
+
size='40px'
|
|
83
|
+
invert
|
|
84
|
+
margin='both'
|
|
85
|
+
/>
|
|
86
|
+
</ReqorePanel>
|
|
87
|
+
<br />
|
|
88
|
+
<ReqorePanel label='Margined' flat minimal>
|
|
89
|
+
<ReqoreIcon icon='AccountCircleLine' />
|
|
90
|
+
No Margin
|
|
91
|
+
<div>
|
|
92
|
+
<ReqoreIcon icon='4KFill' margin='right' />
|
|
93
|
+
Right Margin
|
|
94
|
+
</div>
|
|
95
|
+
<div>
|
|
96
|
+
Left Margin
|
|
97
|
+
<ReqoreIcon
|
|
98
|
+
image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
|
|
99
|
+
size='20px'
|
|
100
|
+
rounded
|
|
101
|
+
margin='left'
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
<div>
|
|
105
|
+
Both
|
|
106
|
+
<ReqoreIcon icon='HotelFill' margin='both' />
|
|
107
|
+
Sides
|
|
108
|
+
</div>
|
|
109
|
+
</ReqorePanel>
|
|
33
110
|
</>
|
|
34
111
|
);
|
|
35
112
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
2
|
import { noop } from 'lodash';
|
|
3
3
|
import ReqoreMessage, { IReqoreMessageProps } from '../../components/Message';
|
|
4
|
-
import {
|
|
4
|
+
import { FlatArg, IntentArg, SizeArg, argManager } from '../utils/args';
|
|
5
5
|
|
|
6
6
|
const { createArg } = argManager<IReqoreMessageProps>();
|
|
7
7
|
|
|
@@ -52,6 +52,12 @@ Minimal.args = {
|
|
|
52
52
|
intent: 'danger',
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
export const Opaque: Story<IReqoreMessageProps> = Template.bind({});
|
|
56
|
+
Opaque.args = {
|
|
57
|
+
opaque: true,
|
|
58
|
+
intent: 'info',
|
|
59
|
+
};
|
|
60
|
+
|
|
55
61
|
export const CustomTheme: Story<IReqoreMessageProps> = Template.bind({});
|
|
56
62
|
CustomTheme.args = {
|
|
57
63
|
customTheme: {
|
|
@@ -162,9 +162,9 @@ NoLabel.args = {
|
|
|
162
162
|
label: undefined,
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
-
export const
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
export const Transparent: Story<IReqorePanelProps> = Template.bind({});
|
|
166
|
+
Transparent.args = {
|
|
167
|
+
transparent: true,
|
|
168
168
|
};
|
|
169
169
|
|
|
170
170
|
export const Minimal: Story<IReqorePanelProps> = Template.bind({});
|