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