@qoretechnologies/reqore 0.30.6 → 0.30.8
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 +104 -104
- package/CONTRIBUTING.MD +78 -78
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/SECURITY.md +5 -5
- package/__tests__/collection.test.tsx +1 -1
- package/__tests__/{control_group.text.tsx → control_group.test.tsx} +4 -2
- package/__tests__/modal.test.tsx +74 -2
- package/__tests__/panel.test.tsx +96 -24
- package/__tests__/popover.test.tsx +24 -2
- package/__tests__/tabs.test.tsx +75 -0
- package/dist/components/Button/index.d.ts +6 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +30 -20
- 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 +6 -3
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +7 -2
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +57 -53
- 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 +15 -4
- 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 +21 -4
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +250 -55
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +2 -2
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +27 -16
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +1 -0
- 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/Effect/index.d.ts +1 -1
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +7 -6
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +5 -6
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +14 -7
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +10 -4
- 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 +12 -10
- 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 +2 -0
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +2 -2
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +1 -1
- 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/Panel/index.d.ts +13 -6
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +78 -44
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +1 -2
- 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 +2 -0
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spacer/index.js +29 -7
- 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 +3 -2
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +6 -3
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +0 -5
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +3 -7
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tabs/content.d.ts +3 -1
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/content.js +8 -3
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +4 -1
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +12 -4
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +1 -0
- 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 +7 -6
- 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 +7 -8
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.d.ts +6 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +24 -12
- 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.js +10 -10
- package/dist/constants/sizes.js.map +1 -1
- package/dist/containers/PopoverProvider.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.js +10 -8
- package/dist/containers/PopoverProvider.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +4 -2
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +7 -0
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +2 -0
- 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 +6 -2
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/utils.d.ts +3 -0
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +16 -1
- 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 +1 -0
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +8 -6
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/styles.d.ts +1 -0
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +6 -5
- package/dist/styles.js.map +1 -1
- package/dist/types/global.d.ts +26 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +79 -34
- package/src/components/Checkbox/index.tsx +3 -2
- package/src/components/Collection/index.tsx +93 -60
- package/src/components/Collection/item.tsx +29 -9
- package/src/components/Columns/column.tsx +1 -0
- package/src/components/ControlGroup/index.tsx +449 -104
- package/src/components/Drawer/index.tsx +28 -27
- package/src/components/Dropdown/index.tsx +3 -1
- package/src/components/Effect/index.tsx +22 -14
- package/src/components/Icon/index.tsx +81 -62
- package/src/components/Input/index.tsx +8 -3
- package/src/components/InternalPopover/index.tsx +131 -126
- package/src/components/Menu/index.tsx +7 -1
- package/src/components/Message/index.tsx +9 -1
- package/src/components/MultiSelect/index.tsx +180 -188
- package/src/components/Panel/index.tsx +227 -100
- package/src/components/Popover/index.tsx +1 -3
- package/src/components/Spacer/index.tsx +63 -14
- package/src/components/Table/header.tsx +2 -2
- package/src/components/Table/headerCell.tsx +2 -2
- package/src/components/Table/helpers.ts +12 -6
- package/src/components/Table/index.tsx +1 -0
- package/src/components/Table/row.tsx +2 -7
- package/src/components/Tabs/content.tsx +11 -3
- package/src/components/Tabs/index.tsx +14 -3
- package/src/components/Tabs/item.tsx +28 -5
- package/src/components/Tabs/list.tsx +7 -3
- package/src/components/Tag/group.tsx +6 -12
- package/src/components/Tag/index.tsx +69 -35
- 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 +11 -8
- package/src/containers/ReqoreProvider.tsx +40 -35
- package/src/containers/UIProvider.tsx +7 -0
- package/src/context/ReqoreContext.tsx +2 -0
- package/src/helpers/colors.ts +8 -2
- package/src/helpers/utils.ts +18 -0
- package/src/hooks/useLatestZIndex.ts +2 -2
- package/src/hooks/usePopover.tsx +9 -6
- package/src/mock/collectionData.tsx +33 -2
- package/src/stories/Button/Button.stories.tsx +72 -7
- package/src/stories/Checkbox/Checkbox.stories.tsx +6 -3
- package/src/stories/Collection/Collection.stories.tsx +18 -2
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +282 -33
- package/src/stories/Drawer/Drawer.stories.tsx +70 -3
- package/src/stories/Dropdown/Dropdown.stories.tsx +13 -3
- package/src/stories/Icon/Icon.stories.tsx +1 -0
- package/src/stories/Input/Input.stories.tsx +5 -3
- package/src/stories/Menu/Menu.stories.tsx +2 -0
- package/src/stories/Message/Message.stories.tsx +7 -0
- package/src/stories/Panel/Panel.stories.tsx +147 -13
- package/src/stories/Popover/Popover.stories.tsx +88 -82
- package/src/stories/Tabs/Tabs.stories.tsx +33 -15
- package/src/stories/Tag/Tag.stories.tsx +23 -3
- package/src/stories/TextArea/TextArea.stories.tsx +3 -3
- package/src/styles.ts +6 -0
- package/src/types/global.ts +28 -0
- package/tests.json +1 -1
|
@@ -21,10 +21,13 @@ import {
|
|
|
21
21
|
} from '../../helpers/colors';
|
|
22
22
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
23
23
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
24
|
+
import { ActiveIconScale, InactiveIconScale } from '../../styles';
|
|
24
25
|
import {
|
|
25
26
|
IReqoreDisabled,
|
|
26
27
|
IReqoreIntent,
|
|
27
28
|
IWithReqoreEffect,
|
|
29
|
+
IWithReqoreFixed,
|
|
30
|
+
IWithReqoreFluid,
|
|
28
31
|
IWithReqoreMinimal,
|
|
29
32
|
IWithReqoreTooltip,
|
|
30
33
|
} from '../../types/global';
|
|
@@ -34,6 +37,7 @@ import ReqoreIcon from '../Icon';
|
|
|
34
37
|
|
|
35
38
|
export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
|
|
36
39
|
icon: IReqoreIconName;
|
|
40
|
+
show?: boolean;
|
|
37
41
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
38
42
|
}
|
|
39
43
|
|
|
@@ -42,7 +46,9 @@ export interface IReqoreTagProps
|
|
|
42
46
|
IWithReqoreTooltip,
|
|
43
47
|
IReqoreDisabled,
|
|
44
48
|
IWithReqoreEffect,
|
|
45
|
-
IWithReqoreMinimal
|
|
49
|
+
IWithReqoreMinimal,
|
|
50
|
+
IWithReqoreFluid,
|
|
51
|
+
IWithReqoreFixed {
|
|
46
52
|
size?: TSizes;
|
|
47
53
|
label?: string | number;
|
|
48
54
|
labelKey?: string | number;
|
|
@@ -50,6 +56,9 @@ export interface IReqoreTagProps
|
|
|
50
56
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
51
57
|
icon?: IReqoreIconName;
|
|
52
58
|
rightIcon?: IReqoreIconName;
|
|
59
|
+
iconColor?: TReqoreEffectColor;
|
|
60
|
+
leftIconColor?: TReqoreEffectColor;
|
|
61
|
+
rightIconColor?: TReqoreEffectColor;
|
|
53
62
|
color?: TReqoreEffectColor;
|
|
54
63
|
actions?: IReqoreTagAction[];
|
|
55
64
|
width?: string;
|
|
@@ -77,10 +86,15 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
77
86
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
78
87
|
|
|
79
88
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
89
|
+
max-width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
90
|
+
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
91
|
+
align-self: ${({ fixed, fluid }) => (fixed ? 'flex-start' : fluid ? 'stretch' : undefined)};
|
|
80
92
|
border-radius: ${({ asBadge, size }) => (asBadge ? 18 : RADIUS_FROM_SIZE[size])}px;
|
|
81
93
|
width: ${({ width }) => width || undefined};
|
|
82
94
|
transition: all 0.2s ease-out;
|
|
83
95
|
|
|
96
|
+
${InactiveIconScale};
|
|
97
|
+
|
|
84
98
|
${({ wrap, hasWidth }) =>
|
|
85
99
|
wrap || hasWidth
|
|
86
100
|
? css`
|
|
@@ -106,16 +120,24 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
106
120
|
`}
|
|
107
121
|
|
|
108
122
|
${({ theme, color, interactive, minimal, effect }) =>
|
|
109
|
-
interactive
|
|
123
|
+
interactive
|
|
110
124
|
? css`
|
|
111
125
|
cursor: pointer;
|
|
112
126
|
&:hover {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
.reqore-tag-content,
|
|
128
|
+
.reqore-tag-key-content {
|
|
129
|
+
${ActiveIconScale}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
${!effect?.gradient &&
|
|
133
|
+
css`
|
|
134
|
+
background-color: ${changeLightness(color || theme.main, color ? 0.05 : 0.15)};
|
|
135
|
+
color: ${minimal
|
|
136
|
+
? getReadableColor(theme, undefined, undefined, false, theme.originalMain)
|
|
137
|
+
: color
|
|
138
|
+
? getReadableColorFrom(color)
|
|
139
|
+
: getReadableColor(theme, undefined, undefined)};
|
|
140
|
+
`}
|
|
119
141
|
}
|
|
120
142
|
`
|
|
121
143
|
: undefined}
|
|
@@ -130,8 +152,6 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
130
152
|
`}
|
|
131
153
|
`;
|
|
132
154
|
|
|
133
|
-
const StyledTagRightIcon = styled(ReqoreIcon)``;
|
|
134
|
-
|
|
135
155
|
const StyledTagKeyWrapper = styled.span<{ size: TSizes }>`
|
|
136
156
|
display: flex;
|
|
137
157
|
align-items: center;
|
|
@@ -227,6 +247,9 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
227
247
|
minimal,
|
|
228
248
|
wrap = false,
|
|
229
249
|
width,
|
|
250
|
+
leftIconColor,
|
|
251
|
+
rightIconColor,
|
|
252
|
+
iconColor,
|
|
230
253
|
...rest
|
|
231
254
|
}: IReqoreTagProps,
|
|
232
255
|
ref
|
|
@@ -252,6 +275,7 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
252
275
|
{...rest}
|
|
253
276
|
effect={{
|
|
254
277
|
...rest.effect,
|
|
278
|
+
gradient: intent ? undefined : rest.effect?.gradient,
|
|
255
279
|
interactive: !!onClick && !rest.disabled,
|
|
256
280
|
}}
|
|
257
281
|
width={width}
|
|
@@ -276,7 +300,14 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
276
300
|
hasWidth={!!width}
|
|
277
301
|
hasKey={!!labelKey}
|
|
278
302
|
>
|
|
279
|
-
{icon &&
|
|
303
|
+
{icon && (
|
|
304
|
+
<ReqoreIcon
|
|
305
|
+
icon={icon}
|
|
306
|
+
size={size}
|
|
307
|
+
margin={label ? 'left' : 'both'}
|
|
308
|
+
color={leftIconColor || iconColor}
|
|
309
|
+
/>
|
|
310
|
+
)}
|
|
280
311
|
{labelKey && (
|
|
281
312
|
<StyledTagContentKey wrap={wrap} hasWidth={!!width} size={size}>
|
|
282
313
|
{labelKey}
|
|
@@ -299,37 +330,40 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
299
330
|
</StyledTagContent>
|
|
300
331
|
) : null}
|
|
301
332
|
{rightIcon && (
|
|
302
|
-
<
|
|
333
|
+
<ReqoreIcon
|
|
303
334
|
icon={rightIcon}
|
|
304
335
|
size={size}
|
|
305
336
|
margin={label || icon ? 'right' : 'both'}
|
|
337
|
+
color={rightIconColor || iconColor}
|
|
306
338
|
/>
|
|
307
339
|
)}
|
|
308
340
|
</StyledTagContentWrapper>
|
|
309
341
|
) : null}
|
|
310
342
|
{_size(actions)
|
|
311
|
-
? actions
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
343
|
+
? actions
|
|
344
|
+
.filter((action) => action.show !== false)
|
|
345
|
+
.map((action, index) => (
|
|
346
|
+
<React.Fragment key={index}>
|
|
347
|
+
<ReqorePopover
|
|
348
|
+
component={StyledButtonWrapper}
|
|
349
|
+
componentProps={{
|
|
350
|
+
size,
|
|
351
|
+
color: getCustomColor(action.intent),
|
|
352
|
+
className: 'reqore-tag-action',
|
|
353
|
+
onClick: action.onClick,
|
|
354
|
+
effect: rest.effect,
|
|
355
|
+
}}
|
|
356
|
+
{...(action.tooltip
|
|
357
|
+
? typeof action.tooltip === 'string'
|
|
358
|
+
? { tooltip: action.tooltip }
|
|
359
|
+
: action.tooltip
|
|
360
|
+
: {})}
|
|
361
|
+
isReqoreComponent
|
|
362
|
+
>
|
|
363
|
+
<ReqoreIcon icon={action.icon} size={size} />
|
|
364
|
+
</ReqorePopover>
|
|
365
|
+
</React.Fragment>
|
|
366
|
+
))
|
|
333
367
|
: null}
|
|
334
368
|
{onRemoveClick && !rest.disabled ? (
|
|
335
369
|
<ReqorePopover
|
|
@@ -341,7 +375,7 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
341
375
|
onClick: onRemoveClick,
|
|
342
376
|
effect: rest.effect,
|
|
343
377
|
}}
|
|
344
|
-
|
|
378
|
+
isReqoreComponent
|
|
345
379
|
content='Remove'
|
|
346
380
|
>
|
|
347
381
|
<ReqoreIcon icon='CloseLine' size={size} />
|
|
@@ -181,7 +181,7 @@ export const ReqoreTree = ({
|
|
|
181
181
|
return (
|
|
182
182
|
<StyledTreeWrapper className='reqore-tree'>
|
|
183
183
|
{showControls && (
|
|
184
|
-
<ReqoreControlGroup stack size={size}>
|
|
184
|
+
<ReqoreControlGroup stack size={size} responsive>
|
|
185
185
|
{isDeep() && !allExpanded ? (
|
|
186
186
|
<ReqoreButton
|
|
187
187
|
flat
|
package/src/constants/sizes.ts
CHANGED
|
@@ -37,19 +37,19 @@ export const HEADER_SIZE_TO_NUMBER = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const SIZE_TO_PX = {
|
|
40
|
-
tiny:
|
|
41
|
-
small:
|
|
40
|
+
tiny: 18,
|
|
41
|
+
small: 24,
|
|
42
42
|
normal: 30,
|
|
43
43
|
big: 40,
|
|
44
44
|
huge: 50,
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export const BADGE_SIZE_TO_PX = {
|
|
48
|
-
tiny:
|
|
49
|
-
small:
|
|
50
|
-
normal:
|
|
51
|
-
big:
|
|
52
|
-
huge:
|
|
48
|
+
tiny: 14,
|
|
49
|
+
small: 20,
|
|
50
|
+
normal: 26,
|
|
51
|
+
big: 32,
|
|
52
|
+
huge: 38,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export const TABS_SIZE_TO_PX = {
|
|
@@ -109,9 +109,9 @@ export const PADDING_FROM_SIZE = {
|
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
export const RADIUS_FROM_SIZE = {
|
|
112
|
-
tiny:
|
|
113
|
-
small:
|
|
114
|
-
normal: 5,
|
|
112
|
+
tiny: 4,
|
|
113
|
+
small: 5,
|
|
114
|
+
normal: 5.5,
|
|
115
115
|
big: 7,
|
|
116
116
|
huge: 9,
|
|
117
117
|
};
|
|
@@ -22,12 +22,15 @@ const PopoverProvider: React.FC<IReqorePopoverProviderProps> = ({ children, uiSc
|
|
|
22
22
|
const handleClick = useCallback(
|
|
23
23
|
(event: MouseEvent) => {
|
|
24
24
|
popovers.forEach(({ popperRef, closeOnAnyClick, closeOnOutsideClick, id, targetElement }) => {
|
|
25
|
+
if (closeOnAnyClick) {
|
|
26
|
+
removePopover(id);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
if (
|
|
26
|
-
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
!popperRef.current.contains(event.target) &&
|
|
30
|
-
!targetElement?.contains(event.target as Node))
|
|
31
|
+
closeOnOutsideClick &&
|
|
32
|
+
!(popperRef?.current && popperRef.current.contains(event.target)) &&
|
|
33
|
+
!targetElement?.contains(event.target as Node)
|
|
31
34
|
) {
|
|
32
35
|
removePopover(id);
|
|
33
36
|
}
|
|
@@ -66,21 +69,21 @@ const PopoverProvider: React.FC<IReqorePopoverProviderProps> = ({ children, uiSc
|
|
|
66
69
|
};
|
|
67
70
|
|
|
68
71
|
useEffect(() => {
|
|
69
|
-
document.addEventListener('click', handleClick);
|
|
72
|
+
document.addEventListener('click', handleClick, true);
|
|
70
73
|
|
|
71
74
|
if (closePopoversOnEscPress) {
|
|
72
75
|
document.addEventListener('keydown', handleKeyDown);
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
return () => {
|
|
76
|
-
document.removeEventListener('click', handleClick);
|
|
79
|
+
document.removeEventListener('click', handleClick, true);
|
|
77
80
|
document.removeEventListener('keydown', handleKeyDown);
|
|
78
81
|
};
|
|
79
82
|
}, [popovers]);
|
|
80
83
|
|
|
81
84
|
useEffect(() => {
|
|
82
85
|
if (!size(popovers)) {
|
|
83
|
-
document.removeEventListener('click', handleClick);
|
|
86
|
+
document.removeEventListener('click', handleClick, true);
|
|
84
87
|
document.removeEventListener('keydown', handleKeyDown);
|
|
85
88
|
}
|
|
86
89
|
}, [popovers]);
|
|
@@ -120,8 +120,10 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, options = {}
|
|
|
120
120
|
isMobile,
|
|
121
121
|
isTablet,
|
|
122
122
|
isMobileOrTablet,
|
|
123
|
+
latestZIndex: latestZIndex.current,
|
|
123
124
|
getAndIncreaseZIndex,
|
|
124
125
|
animations: options.animations || { buttons: true, dialogs: true },
|
|
126
|
+
tooltips: options.tooltips || { delay: 0 },
|
|
125
127
|
closePopoversOnEscPress:
|
|
126
128
|
'closePopoversOnEscPress' in options ? options.closePopoversOnEscPress : true,
|
|
127
129
|
}}
|
|
@@ -156,44 +158,47 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, options = {}
|
|
|
156
158
|
</ReqoreNotificationsWrapper>
|
|
157
159
|
) : null}
|
|
158
160
|
{children}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
161
|
+
{confirmationModal.isOpen && (
|
|
162
|
+
<ReqoreModal
|
|
163
|
+
isOpen
|
|
164
|
+
flat
|
|
165
|
+
opacity={0.9}
|
|
166
|
+
blur={2}
|
|
167
|
+
width='500px'
|
|
168
|
+
intent={confirmationModal.intent}
|
|
169
|
+
label={confirmationModal.title || 'Confirm your action'}
|
|
170
|
+
icon='ErrorWarningFill'
|
|
171
|
+
className='reqore-confirmation-modal'
|
|
172
|
+
bottomActions={[
|
|
173
|
+
{
|
|
174
|
+
label: confirmationModal.cancelLabel || 'Cancel',
|
|
175
|
+
icon: 'CloseLine',
|
|
176
|
+
onClick: () => {
|
|
177
|
+
confirmationModal?.onCancel?.();
|
|
178
|
+
closeConfirmationModal();
|
|
179
|
+
},
|
|
180
|
+
position: 'left',
|
|
175
181
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
{
|
|
183
|
+
label: confirmationModal.confirmLabel || 'Confirm',
|
|
184
|
+
intent: confirmationModal.confirmButtonIntent || 'success',
|
|
185
|
+
icon: confirmationModal.confirmIcon || 'CheckLine',
|
|
186
|
+
onClick: () => {
|
|
187
|
+
confirmationModal?.onConfirm?.();
|
|
188
|
+
closeConfirmationModal();
|
|
189
|
+
},
|
|
190
|
+
position: 'right',
|
|
185
191
|
},
|
|
186
|
-
|
|
187
|
-
},
|
|
188
|
-
]}
|
|
189
|
-
>
|
|
190
|
-
<ReqoreTextEffect
|
|
191
|
-
as='p'
|
|
192
|
-
effect={{ textAlign: 'center', weight: 'bold', textSize: 'big' }}
|
|
192
|
+
]}
|
|
193
193
|
>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
<ReqoreTextEffect
|
|
195
|
+
as='p'
|
|
196
|
+
effect={{ textAlign: 'center', weight: 'bold', textSize: 'big' }}
|
|
197
|
+
>
|
|
198
|
+
{confirmationModal.description || 'Are you sure you want to proceed?'}
|
|
199
|
+
</ReqoreTextEffect>
|
|
200
|
+
</ReqoreModal>
|
|
201
|
+
)}
|
|
197
202
|
</ReqoreContext.Provider>
|
|
198
203
|
</>
|
|
199
204
|
);
|
|
@@ -18,6 +18,13 @@ export interface IReqoreOptions {
|
|
|
18
18
|
buttons?: boolean;
|
|
19
19
|
dialogs?: boolean;
|
|
20
20
|
};
|
|
21
|
+
tooltips?: {
|
|
22
|
+
/**
|
|
23
|
+
* Delay in ms before showing the tooltip
|
|
24
|
+
* @default 0
|
|
25
|
+
* */
|
|
26
|
+
delay?: number;
|
|
27
|
+
};
|
|
21
28
|
closePopoversOnEscPress?: boolean;
|
|
22
29
|
}
|
|
23
30
|
export interface IReqoreUIProviderProps {
|
|
@@ -12,7 +12,9 @@ export interface IReqoreContext {
|
|
|
12
12
|
readonly isMobileOrTablet?: boolean;
|
|
13
13
|
readonly getAndIncreaseZIndex?: () => number;
|
|
14
14
|
readonly animations?: IReqoreOptions['animations'];
|
|
15
|
+
readonly tooltips?: IReqoreOptions['tooltips'];
|
|
15
16
|
readonly closePopoversOnEscPress?: boolean;
|
|
17
|
+
readonly latestZIndex?: number;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export default createContext<IReqoreContext>({
|
package/src/helpers/colors.ts
CHANGED
|
@@ -96,6 +96,9 @@ export const buildTheme = (theme: IReqoreTheme): IReqoreTheme => {
|
|
|
96
96
|
newTheme.main = '#333333';
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// Add the original theme main color to the theme
|
|
100
|
+
newTheme.originalMain = newTheme.main;
|
|
101
|
+
|
|
99
102
|
if (!newTheme.notifications?.info) {
|
|
100
103
|
newTheme.notifications.info = newTheme.intents.info || DEFAULT_INTENTS.info;
|
|
101
104
|
}
|
|
@@ -200,7 +203,8 @@ export const createEffectGradient = (
|
|
|
200
203
|
theme: IReqoreTheme,
|
|
201
204
|
colors: TReqoreEffectGradientColors,
|
|
202
205
|
lighten: number = 0,
|
|
203
|
-
minimal?: boolean
|
|
206
|
+
minimal?: boolean,
|
|
207
|
+
active?: boolean
|
|
204
208
|
): string => {
|
|
205
209
|
let _colors: TReqoreEffectGradientColorsObject;
|
|
206
210
|
// Check if the colors are valid
|
|
@@ -219,7 +223,9 @@ export const createEffectGradient = (
|
|
|
219
223
|
(colorsString, color, percentage) => {
|
|
220
224
|
return `${colorsString}, ${
|
|
221
225
|
minimal
|
|
222
|
-
?
|
|
226
|
+
? active
|
|
227
|
+
? theme.originalMain
|
|
228
|
+
: changeLightness(theme.originalMain, lighten)
|
|
223
229
|
: changeLightness(getColorFromMaybeString(theme, color), lighten)
|
|
224
230
|
} ${percentage}%`;
|
|
225
231
|
},
|
package/src/helpers/utils.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
isString,
|
|
9
9
|
isUndefined,
|
|
10
10
|
} from 'lodash';
|
|
11
|
+
import { IReqorePanelAction } from '../components/Panel';
|
|
11
12
|
import { NUMBER_TO_SIZE, SIZES, SIZE_TO_NUMBER, TSizes } from '../constants/sizes';
|
|
12
13
|
|
|
13
14
|
export const sleep = async (ms: number) => await new Promise((r) => setTimeout(r, ms));
|
|
@@ -88,3 +89,20 @@ export const getOneLessSize = (size: TSizes): TSizes => {
|
|
|
88
89
|
// Get the size name from the number
|
|
89
90
|
return NUMBER_TO_SIZE[oneLessSizeNumber];
|
|
90
91
|
};
|
|
92
|
+
|
|
93
|
+
export const isActionShown = (action: IReqorePanelAction) => action.show !== false;
|
|
94
|
+
|
|
95
|
+
export const alignToFlexAlign = (
|
|
96
|
+
align: 'left' | 'right' | 'center'
|
|
97
|
+
): 'flex-start' | 'center' | 'flex-end' => {
|
|
98
|
+
switch (align) {
|
|
99
|
+
case 'left':
|
|
100
|
+
return 'flex-start';
|
|
101
|
+
case 'right':
|
|
102
|
+
return 'flex-end';
|
|
103
|
+
case 'center':
|
|
104
|
+
return 'center';
|
|
105
|
+
default:
|
|
106
|
+
return 'flex-start';
|
|
107
|
+
}
|
|
108
|
+
};
|
|
@@ -2,8 +2,8 @@ import { useContext, useMemo } from 'react';
|
|
|
2
2
|
import { ReqoreContext } from '..';
|
|
3
3
|
|
|
4
4
|
const useLatestZIndex = (): number => {
|
|
5
|
-
const { getAndIncreaseZIndex } = useContext(ReqoreContext);
|
|
6
|
-
const zIndex = useMemo(() => getAndIncreaseZIndex(), []);
|
|
5
|
+
const { getAndIncreaseZIndex, latestZIndex } = useContext(ReqoreContext);
|
|
6
|
+
const zIndex = useMemo(() => getAndIncreaseZIndex(), [latestZIndex]);
|
|
7
7
|
|
|
8
8
|
return zIndex;
|
|
9
9
|
};
|
package/src/hooks/usePopover.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
IWithReqoreMinimal,
|
|
12
12
|
} from '../types/global';
|
|
13
13
|
import { IReqoreIconName } from '../types/icons';
|
|
14
|
+
import { useReqore } from './useReqore';
|
|
14
15
|
|
|
15
16
|
const startEvents = {
|
|
16
17
|
hover: 'mouseenter',
|
|
@@ -44,6 +45,7 @@ export interface IPopover
|
|
|
44
45
|
show?: boolean;
|
|
45
46
|
openOnMount?: boolean;
|
|
46
47
|
noArrow?: boolean;
|
|
48
|
+
noWrapper?: boolean;
|
|
47
49
|
useTargetWidth?: boolean;
|
|
48
50
|
closeOnOutsideClick?: boolean;
|
|
49
51
|
closeOnAnyClick?: boolean;
|
|
@@ -76,6 +78,7 @@ const usePopover = ({
|
|
|
76
78
|
}: IPopoverOptions): IPopoverControls => {
|
|
77
79
|
const { addPopover, removePopover, updatePopover, popovers, isPopoverOpen } =
|
|
78
80
|
useContext(PopoverContext);
|
|
81
|
+
const { tooltips } = useReqore();
|
|
79
82
|
const { current }: MutableRefObject<string> = useRef(shortid.generate());
|
|
80
83
|
let { current: timeout }: MutableRefObject<any> = useRef(0);
|
|
81
84
|
|
|
@@ -95,11 +98,11 @@ const usePopover = ({
|
|
|
95
98
|
noArrow,
|
|
96
99
|
useTargetWidth,
|
|
97
100
|
closeOnOutsideClick,
|
|
98
|
-
closeOnAnyClick: handler === 'hover'
|
|
101
|
+
closeOnAnyClick: handler === 'hover',
|
|
99
102
|
...rest,
|
|
100
103
|
});
|
|
101
104
|
|
|
102
|
-
if (rest
|
|
105
|
+
if (rest.blur > 0) {
|
|
103
106
|
targetElement.style.position = 'relative';
|
|
104
107
|
targetElement.style.zIndex = '999999';
|
|
105
108
|
}
|
|
@@ -108,13 +111,13 @@ const usePopover = ({
|
|
|
108
111
|
const _addPopover = () => {
|
|
109
112
|
if (currentPopover) {
|
|
110
113
|
if (handler !== 'hoverStay' && handler !== 'focus') {
|
|
111
|
-
_removePopover
|
|
114
|
+
_removePopover();
|
|
112
115
|
}
|
|
113
116
|
} else if (show) {
|
|
114
|
-
if (delay) {
|
|
117
|
+
if (delay || tooltips.delay) {
|
|
115
118
|
timeout = setTimeout(() => {
|
|
116
119
|
openPopover();
|
|
117
|
-
}, delay);
|
|
120
|
+
}, delay || tooltips.delay);
|
|
118
121
|
} else {
|
|
119
122
|
openPopover();
|
|
120
123
|
}
|
|
@@ -141,7 +144,7 @@ const usePopover = ({
|
|
|
141
144
|
noArrow,
|
|
142
145
|
useTargetWidth,
|
|
143
146
|
closeOnOutsideClick,
|
|
144
|
-
closeOnAnyClick: handler === 'hover'
|
|
147
|
+
closeOnAnyClick: handler === 'hover',
|
|
145
148
|
...rest,
|
|
146
149
|
});
|
|
147
150
|
}
|
|
@@ -32,6 +32,8 @@ export default [
|
|
|
32
32
|
tooltip: 'This is a test item',
|
|
33
33
|
headerSize: 2,
|
|
34
34
|
contentSize: 'huge',
|
|
35
|
+
selected: true,
|
|
36
|
+
icon: 'Hashtag',
|
|
35
37
|
content:
|
|
36
38
|
'Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long',
|
|
37
39
|
tags: [
|
|
@@ -51,13 +53,21 @@ export default [
|
|
|
51
53
|
},
|
|
52
54
|
{
|
|
53
55
|
icon: 'TextWrap',
|
|
54
|
-
label: '
|
|
56
|
+
label: 'Small item that is not minimal',
|
|
55
57
|
tooltip: 'This is a test item',
|
|
58
|
+
size: 'small',
|
|
56
59
|
content:
|
|
57
60
|
'Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long',
|
|
58
61
|
minimal: false,
|
|
59
62
|
badge: 0,
|
|
60
63
|
},
|
|
64
|
+
{
|
|
65
|
+
icon: 'ZcoolLine',
|
|
66
|
+
label: 'Item without fade',
|
|
67
|
+
content:
|
|
68
|
+
'Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long Hello I am a test item content and I am very long so will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long Hello I am a test item content and I am very long so will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long',
|
|
69
|
+
showContentFade: false,
|
|
70
|
+
},
|
|
61
71
|
{
|
|
62
72
|
icon: 'FolderWarningFill',
|
|
63
73
|
label: 'Expandable item',
|
|
@@ -82,6 +92,7 @@ export default [
|
|
|
82
92
|
{
|
|
83
93
|
label: 'Item with custom content when expanded',
|
|
84
94
|
tooltip: 'Expandable item with custom content',
|
|
95
|
+
selected: true,
|
|
85
96
|
content:
|
|
86
97
|
'Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long',
|
|
87
98
|
expandable: true,
|
|
@@ -94,6 +105,22 @@ export default [
|
|
|
94
105
|
weight: 'thin',
|
|
95
106
|
spaced: 2,
|
|
96
107
|
},
|
|
108
|
+
expandedActions: [
|
|
109
|
+
{
|
|
110
|
+
label: 'Action 1',
|
|
111
|
+
id: 'action1',
|
|
112
|
+
icon: 'CapsuleFill',
|
|
113
|
+
onClick: () => alert('Action 1 clicked'),
|
|
114
|
+
position: 'left',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: 'Action 2',
|
|
118
|
+
id: 'action2',
|
|
119
|
+
icon: 'CapsuleFill',
|
|
120
|
+
onClick: () => alert('Action 2 clicked'),
|
|
121
|
+
position: 'right',
|
|
122
|
+
},
|
|
123
|
+
],
|
|
97
124
|
expandedContent: (
|
|
98
125
|
<>
|
|
99
126
|
<ReqoreMessage intent='info'>Hello I am a custom content</ReqoreMessage>
|
|
@@ -181,6 +208,9 @@ export default [
|
|
|
181
208
|
},
|
|
182
209
|
{
|
|
183
210
|
label: 'I have intent!',
|
|
211
|
+
transparent: true,
|
|
212
|
+
minimal: false,
|
|
213
|
+
flat: false,
|
|
184
214
|
content: (
|
|
185
215
|
<ReqoreP>
|
|
186
216
|
'Well would you look at that. Lorem ipsum dolor{' '}
|
|
@@ -232,13 +262,14 @@ export default [
|
|
|
232
262
|
{
|
|
233
263
|
label: 'I have actions',
|
|
234
264
|
content:
|
|
235
|
-
'Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long',
|
|
265
|
+
'Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long. Hello I am a test item content and I am very long so I will wrap to the next line and I will be very long',
|
|
236
266
|
actions: [
|
|
237
267
|
{
|
|
238
268
|
label: 'Action 1',
|
|
239
269
|
id: 'action1',
|
|
240
270
|
icon: 'CapsuleFill',
|
|
241
271
|
onClick: () => alert('Action 1 clicked'),
|
|
272
|
+
show: false,
|
|
242
273
|
},
|
|
243
274
|
{
|
|
244
275
|
label: 'Action 2',
|