@qoretechnologies/reqore 0.30.3 → 0.30.5
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__/modal.test.tsx +74 -2
- package/dist/components/Button/index.d.ts +3 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +26 -19
- 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 +5 -2
- 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 +20 -11
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +21 -12
- package/dist/components/Drawer/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 +6 -5
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +6 -3
- package/dist/components/Input/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/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/list.js +3 -3
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +7 -3
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +3 -2
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +1 -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 +1 -0
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +14 -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/package.json +1 -1
- package/src/components/Button/index.tsx +65 -32
- package/src/components/Checkbox/index.tsx +2 -1
- package/src/components/ControlGroup/index.tsx +27 -5
- package/src/components/Drawer/index.tsx +21 -22
- package/src/components/Effect/index.tsx +21 -14
- package/src/components/Input/index.tsx +2 -1
- package/src/components/Table/header.tsx +2 -2
- package/src/components/Table/headerCell.tsx +2 -2
- package/src/components/Table/row.tsx +2 -7
- package/src/components/Tabs/list.tsx +3 -3
- package/src/components/Tag/index.tsx +3 -1
- package/src/containers/ReqoreProvider.tsx +39 -35
- package/src/context/ReqoreContext.tsx +1 -0
- package/src/helpers/colors.ts +8 -2
- package/src/helpers/utils.ts +15 -0
- package/src/hooks/useLatestZIndex.ts +2 -2
- package/src/stories/Button/Button.stories.tsx +58 -1
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +65 -2
- package/src/stories/Drawer/Drawer.stories.tsx +65 -2
- package/src/stories/Tabs/Tabs.stories.tsx +1 -0
- package/tests.json +1 -1
|
@@ -47,6 +47,7 @@ export interface IReqoreControlGroupProps
|
|
|
47
47
|
isChild?: boolean;
|
|
48
48
|
isFirstGroup?: boolean;
|
|
49
49
|
isLastGroup?: boolean;
|
|
50
|
+
fill?: boolean;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export interface IReqoreControlGroupStyle extends IReqoreControlGroupProps {
|
|
@@ -55,7 +56,7 @@ export interface IReqoreControlGroupStyle extends IReqoreControlGroupProps {
|
|
|
55
56
|
|
|
56
57
|
export const StyledReqoreControlGroup = styled.div<IReqoreControlGroupStyle>`
|
|
57
58
|
display: flex;
|
|
58
|
-
flex: 0 auto;
|
|
59
|
+
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
59
60
|
width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
60
61
|
justify-content: ${({ fluid, vertical }) => (vertical && fluid ? 'stretch' : undefined)};
|
|
61
62
|
align-items: ${({ vertical, fluid, horizontalAlign }) =>
|
|
@@ -64,11 +65,29 @@ export const StyledReqoreControlGroup = styled.div<IReqoreControlGroupStyle>`
|
|
|
64
65
|
gap: ${({ gapSize, stack }) => (!stack ? `${GAP_FROM_SIZE[gapSize]}px` : undefined)};
|
|
65
66
|
flex-wrap: ${({ wrap }) => (wrap ? 'wrap' : 'nowrap')};
|
|
66
67
|
|
|
68
|
+
// If the group has the fill prop,
|
|
69
|
+
// we need to make sure that the children are vertically stretched
|
|
70
|
+
// kind of like 'fluid' but vertically
|
|
71
|
+
// ! Only works when the group is horizontal & wrap is false
|
|
72
|
+
${({ fill, vertical }) => {
|
|
73
|
+
if (fill && !vertical) {
|
|
74
|
+
return css`
|
|
75
|
+
> * {
|
|
76
|
+
max-height: 100%;
|
|
77
|
+
height: unset !important;
|
|
78
|
+
align-self: stretch;
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return undefined;
|
|
84
|
+
}}
|
|
85
|
+
|
|
67
86
|
> * {
|
|
68
|
-
margin-top: ${({ verticalAlign }) =>
|
|
69
|
-
verticalAlign === 'flex-end' || verticalAlign === 'center' ? 'auto' : undefined};
|
|
70
|
-
margin-bottom: ${({ verticalAlign }) =>
|
|
71
|
-
verticalAlign === 'flex-start' || verticalAlign === 'center' ? 'auto' : undefined};
|
|
87
|
+
margin-top: ${({ fill, verticalAlign }) =>
|
|
88
|
+
!fill && (verticalAlign === 'flex-end' || verticalAlign === 'center') ? 'auto' : undefined};
|
|
89
|
+
margin-bottom: ${({ fill, verticalAlign }) =>
|
|
90
|
+
!fill && (verticalAlign === 'flex-start' || verticalAlign === 'center') ? 'auto' : undefined};
|
|
72
91
|
margin-right: ${({ horizontalAlign }) => (horizontalAlign === 'center' ? 'auto' : undefined)};
|
|
73
92
|
|
|
74
93
|
${({ vertical }) =>
|
|
@@ -103,6 +122,7 @@ const ReqoreControlGroup = memo(
|
|
|
103
122
|
fluid,
|
|
104
123
|
flat,
|
|
105
124
|
fixed,
|
|
125
|
+
fill,
|
|
106
126
|
rounded = true,
|
|
107
127
|
wrap,
|
|
108
128
|
stack,
|
|
@@ -324,6 +344,7 @@ const ReqoreControlGroup = memo(
|
|
|
324
344
|
flat: child.props?.flat || child.props?.flat === false ? child.props.flat : flat,
|
|
325
345
|
fluid: child.props?.fluid || child.props?.fluid === false ? child.props.fluid : fluid,
|
|
326
346
|
fixed: child.props?.fixed || child.props?.fixed === false ? child.props.fixed : fixed,
|
|
347
|
+
fill,
|
|
327
348
|
stack:
|
|
328
349
|
child.props?.stack || child.props?.stack === false ? child.props.stack : isStack,
|
|
329
350
|
intent: child.props?.intent || intent,
|
|
@@ -454,6 +475,7 @@ const ReqoreControlGroup = memo(
|
|
|
454
475
|
rounded={rounded}
|
|
455
476
|
fluid={fluid}
|
|
456
477
|
fixed={fixed}
|
|
478
|
+
fill={fill}
|
|
457
479
|
wrap={wrap}
|
|
458
480
|
stack={isStack}
|
|
459
481
|
verticalAlign={verticalAlign}
|
|
@@ -170,6 +170,7 @@ export const ReqoreDrawer = ({
|
|
|
170
170
|
_isModal,
|
|
171
171
|
width,
|
|
172
172
|
height,
|
|
173
|
+
actions = [],
|
|
173
174
|
...rest
|
|
174
175
|
}: IReqoreDrawerProps) => {
|
|
175
176
|
const { animations } = useContext(ReqoreContext);
|
|
@@ -199,12 +200,12 @@ export const ReqoreDrawer = ({
|
|
|
199
200
|
|
|
200
201
|
const zIndex = useLatestZIndex();
|
|
201
202
|
const wrapperZIndex = useLatestZIndex();
|
|
202
|
-
const
|
|
203
|
-
const
|
|
203
|
+
const _actions: IReqorePanelAction[] = useMemo(() => {
|
|
204
|
+
const builtActions: IReqorePanelAction[] = [...actions];
|
|
204
205
|
|
|
205
206
|
/* Adding a hide/show button to the drawer. */
|
|
206
207
|
if (hidable) {
|
|
207
|
-
|
|
208
|
+
builtActions.push({
|
|
208
209
|
responsive: false,
|
|
209
210
|
icon: getHideShowIcon(position, _isHidden),
|
|
210
211
|
onClick: () => {
|
|
@@ -219,7 +220,7 @@ export const ReqoreDrawer = ({
|
|
|
219
220
|
|
|
220
221
|
/* Adding a close button to the drawer. */
|
|
221
222
|
if (onClose) {
|
|
222
|
-
|
|
223
|
+
builtActions.push({
|
|
223
224
|
responsive: false,
|
|
224
225
|
icon: 'CloseLine',
|
|
225
226
|
onClick: onClose,
|
|
@@ -227,7 +228,7 @@ export const ReqoreDrawer = ({
|
|
|
227
228
|
});
|
|
228
229
|
}
|
|
229
230
|
|
|
230
|
-
return
|
|
231
|
+
return builtActions;
|
|
231
232
|
}, [hidable, position, onClose]);
|
|
232
233
|
|
|
233
234
|
const positions = useMemo(() => {
|
|
@@ -265,7 +266,7 @@ export const ReqoreDrawer = ({
|
|
|
265
266
|
/>
|
|
266
267
|
) : null}
|
|
267
268
|
<Resizable
|
|
268
|
-
className='reqore-drawer-resizable
|
|
269
|
+
className={`${className || ''} reqore-drawer-resizable`}
|
|
269
270
|
maxHeight={
|
|
270
271
|
layout === 'horizontal' || layout === 'center' ? maxSize || '90vh' : undefined
|
|
271
272
|
}
|
|
@@ -344,21 +345,19 @@ export const ReqoreDrawer = ({
|
|
|
344
345
|
<StyledCloseWrapper
|
|
345
346
|
className='reqore-drawer-controls'
|
|
346
347
|
position={position}
|
|
347
|
-
w={layout === 'vertical'
|
|
348
|
-
h={layout === 'horizontal'
|
|
348
|
+
w={layout === 'vertical' ? 0 : _size.width}
|
|
349
|
+
h={layout === 'horizontal' ? 0 : _size.height}
|
|
349
350
|
>
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
/>
|
|
361
|
-
)}
|
|
351
|
+
<ReqoreButton
|
|
352
|
+
flat
|
|
353
|
+
customTheme={theme}
|
|
354
|
+
className='reqore-drawer-control reqore-drawer-hide-button'
|
|
355
|
+
icon={getHideShowIcon(position, _isHidden)}
|
|
356
|
+
onClick={() => {
|
|
357
|
+
setIsHidden(!_isHidden);
|
|
358
|
+
onHideToggle && onHideToggle(!_isHidden);
|
|
359
|
+
}}
|
|
360
|
+
/>
|
|
362
361
|
</StyledCloseWrapper>
|
|
363
362
|
) : null}
|
|
364
363
|
{!_isHidden && (
|
|
@@ -366,12 +365,12 @@ export const ReqoreDrawer = ({
|
|
|
366
365
|
{...rest}
|
|
367
366
|
opacity={opacity}
|
|
368
367
|
blur={hasBackdrop ? 0 : blur}
|
|
369
|
-
actions={
|
|
368
|
+
actions={_actions}
|
|
370
369
|
customTheme={customTheme}
|
|
371
370
|
intent={intent}
|
|
372
371
|
rounded={floating || _isModal ? true : false}
|
|
373
372
|
flat={flat}
|
|
374
|
-
className={
|
|
373
|
+
className={`reqore-drawer`}
|
|
375
374
|
style={{
|
|
376
375
|
width: '100%',
|
|
377
376
|
maxHeight: '100%',
|
|
@@ -114,10 +114,16 @@ export const StyledEffect = styled.span`
|
|
|
114
114
|
const gradientColors = createEffectGradient(
|
|
115
115
|
theme,
|
|
116
116
|
effect.gradient.colors,
|
|
117
|
-
0,
|
|
117
|
+
minimal ? 0.05 : 0,
|
|
118
118
|
!isText && minimal && !active
|
|
119
119
|
);
|
|
120
|
-
const gradientColorsActive = createEffectGradient(
|
|
120
|
+
const gradientColorsActive = createEffectGradient(
|
|
121
|
+
theme,
|
|
122
|
+
effect.gradient.colors,
|
|
123
|
+
0.05,
|
|
124
|
+
minimal,
|
|
125
|
+
true
|
|
126
|
+
);
|
|
121
127
|
|
|
122
128
|
const gradientDirectionOrShape =
|
|
123
129
|
gradientType === 'linear'
|
|
@@ -167,16 +173,17 @@ export const StyledEffect = styled.span`
|
|
|
167
173
|
background: ${active ? gradientActive : gradient};
|
|
168
174
|
border-color: ${borderColor} !important;
|
|
169
175
|
|
|
170
|
-
${color &&
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
${color && !minimal
|
|
177
|
+
? css`
|
|
178
|
+
color: ${getReadableColorFrom(getColorFromMaybeString(theme, color), false)} !important;
|
|
179
|
+
&::placeholder {
|
|
180
|
+
color: ${rgba(
|
|
181
|
+
getReadableColorFrom(getColorFromMaybeString(theme, color), false),
|
|
182
|
+
0.7
|
|
183
|
+
)} !important;
|
|
184
|
+
}
|
|
185
|
+
`
|
|
186
|
+
: undefined}
|
|
180
187
|
|
|
181
188
|
${effect.gradient.animate === 'always' || (effect.gradient.animate === 'active' && active)
|
|
182
189
|
? css`
|
|
@@ -365,9 +372,9 @@ export const ReqoreEffect = ({ children, ...rest }: IReqoreTextEffectProps) => {
|
|
|
365
372
|
);
|
|
366
373
|
};
|
|
367
374
|
|
|
368
|
-
export const ReqoreTextEffect = ({ children, ...rest }: IReqoreTextEffectProps) => {
|
|
375
|
+
export const ReqoreTextEffect = ({ children, className, ...rest }: IReqoreTextEffectProps) => {
|
|
369
376
|
return (
|
|
370
|
-
<StyledTextEffect className='reqore-text-effect
|
|
377
|
+
<StyledTextEffect className={`${className || ''} reqore-text-effect`} {...rest}>
|
|
371
378
|
{children}
|
|
372
379
|
</StyledTextEffect>
|
|
373
380
|
);
|
|
@@ -60,10 +60,11 @@ export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
|
60
60
|
|
|
61
61
|
export const StyledInputWrapper = styled.div<IReqoreInputStyle>`
|
|
62
62
|
height: ${({ _size }) => SIZE_TO_PX[_size]}px;
|
|
63
|
-
width: ${({ width
|
|
63
|
+
width: ${({ width }) => (width ? `${width}px` : 'auto')};
|
|
64
64
|
max-width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
65
65
|
min-width: 60px;
|
|
66
66
|
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 1 auto')};
|
|
67
|
+
align-self: ${({ fixed, fluid }) => (fixed ? 'flex-start' : fluid ? 'stretch' : undefined)};
|
|
67
68
|
font-size: ${({ _size }) => TEXT_FROM_SIZE[_size]}px;
|
|
68
69
|
position: relative;
|
|
69
70
|
overflow: hidden;
|
|
@@ -2,9 +2,9 @@ import styled, { css } from 'styled-components';
|
|
|
2
2
|
import { IReqoreTableColumn, IReqoreTableSort } from '.';
|
|
3
3
|
import { IReqoreTheme } from '../../constants/theme';
|
|
4
4
|
import { changeLightness } from '../../helpers/colors';
|
|
5
|
+
import { alignToFlexAlign } from '../../helpers/utils';
|
|
5
6
|
import { IReqoreIconName } from '../../types/icons';
|
|
6
7
|
import ReqoreTableHeaderCell, { StyledTableHeader } from './headerCell';
|
|
7
|
-
import { alignToFlex } from './row';
|
|
8
8
|
|
|
9
9
|
export interface IReqoreTableSectionProps {
|
|
10
10
|
columns: IReqoreTableColumn[];
|
|
@@ -46,7 +46,7 @@ export interface IReqoreTableHeaderStyle {
|
|
|
46
46
|
export const StyledColumnGroupHeader = styled.div<IReqoreTableHeaderStyle>`
|
|
47
47
|
${({ align, theme }) => css`
|
|
48
48
|
background-color: ${changeLightness(theme.main, 0.035)};
|
|
49
|
-
justify-content: ${align ?
|
|
49
|
+
justify-content: ${align ? alignToFlexAlign(align) : 'flex-start'};
|
|
50
50
|
`}
|
|
51
51
|
`;
|
|
52
52
|
|
|
@@ -4,9 +4,9 @@ import styled, { css } from 'styled-components';
|
|
|
4
4
|
import { IReqoreTableColumn, IReqoreTableSort } from '.';
|
|
5
5
|
import { IReqoreTheme } from '../../constants/theme';
|
|
6
6
|
import { changeLightness, getReadableColor } from '../../helpers/colors';
|
|
7
|
+
import { alignToFlexAlign } from '../../helpers/utils';
|
|
7
8
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
8
9
|
import ReqoreIcon from '../Icon';
|
|
9
|
-
import { alignToFlex } from './row';
|
|
10
10
|
|
|
11
11
|
export interface IReqoreTableHeaderCellProps
|
|
12
12
|
extends React.HTMLAttributes<HTMLDivElement>,
|
|
@@ -32,7 +32,7 @@ export const StyledTableHeader = styled.div<IReqoreTableHeaderStyle>`
|
|
|
32
32
|
|
|
33
33
|
${({ align, theme }) => css`
|
|
34
34
|
background-color: ${changeLightness(theme.main, 0.03)};
|
|
35
|
-
justify-content: ${align ?
|
|
35
|
+
justify-content: ${align ? alignToFlexAlign(align) : 'flex-start'};
|
|
36
36
|
`}
|
|
37
37
|
|
|
38
38
|
${({ interactive, theme }) =>
|
|
@@ -13,6 +13,7 @@ import { ReqorePopover } from '../..';
|
|
|
13
13
|
import { SIZE_TO_PX, TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
14
14
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
15
15
|
import { changeLightness, getReadableColorFrom } from '../../helpers/colors';
|
|
16
|
+
import { alignToFlexAlign } from '../../helpers/utils';
|
|
16
17
|
import { TReqoreColor, TReqoreHexColor } from '../Effect';
|
|
17
18
|
import { ReqoreH4 } from '../Header';
|
|
18
19
|
import ReqoreIcon from '../Icon';
|
|
@@ -75,12 +76,6 @@ export interface IReqoreTableCellStyle {
|
|
|
75
76
|
striped?: boolean;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
export const alignToFlex = {
|
|
79
|
-
center: 'center',
|
|
80
|
-
left: 'flex-start',
|
|
81
|
-
right: 'flex-end',
|
|
82
|
-
};
|
|
83
|
-
|
|
84
79
|
export const StyledTableCell = styled.div<IReqoreTableCellStyle>`
|
|
85
80
|
${({ width, grow }) =>
|
|
86
81
|
css`
|
|
@@ -137,7 +132,7 @@ export const StyledTableCell = styled.div<IReqoreTableCellStyle>`
|
|
|
137
132
|
return css`
|
|
138
133
|
display: flex;
|
|
139
134
|
align-items: center;
|
|
140
|
-
justify-content: ${align ?
|
|
135
|
+
justify-content: ${align ? alignToFlexAlign(align) : 'flex-start'};
|
|
141
136
|
flex-shrink: 0;
|
|
142
137
|
border-bottom: ${!flat ? '1px solid ' : undefined};
|
|
143
138
|
|
|
@@ -204,10 +204,10 @@ const ReqoreTabsList = ({
|
|
|
204
204
|
label: getMoreLabel(item, activeTab),
|
|
205
205
|
active: !!isTabHidden(item, activeTab),
|
|
206
206
|
activeIntent: activeTabIntent,
|
|
207
|
+
intent: !!isTabHidden(item, activeTab) ? activeTabData?.intent : undefined,
|
|
208
|
+
effect: !!isTabHidden(item, activeTab) ? activeTabData?.effect : undefined,
|
|
207
209
|
customTheme: !!isTabHidden(item, activeTab)
|
|
208
|
-
?
|
|
209
|
-
main: currentTabColor,
|
|
210
|
-
}
|
|
210
|
+
? activeTabData?.customTheme
|
|
211
211
|
: theme,
|
|
212
212
|
vertical,
|
|
213
213
|
flat,
|
|
@@ -86,8 +86,9 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
86
86
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
87
87
|
|
|
88
88
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
89
|
-
width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
89
|
+
max-width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
90
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)};
|
|
91
92
|
border-radius: ${({ asBadge, size }) => (asBadge ? 18 : RADIUS_FROM_SIZE[size])}px;
|
|
92
93
|
width: ${({ width }) => width || undefined};
|
|
93
94
|
transition: all 0.2s ease-out;
|
|
@@ -274,6 +275,7 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
274
275
|
{...rest}
|
|
275
276
|
effect={{
|
|
276
277
|
...rest.effect,
|
|
278
|
+
gradient: intent ? undefined : rest.effect?.gradient,
|
|
277
279
|
interactive: !!onClick && !rest.disabled,
|
|
278
280
|
}}
|
|
279
281
|
width={width}
|
|
@@ -120,6 +120,7 @@ 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 },
|
|
125
126
|
tooltips: options.tooltips || { delay: 0 },
|
|
@@ -157,44 +158,47 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, options = {}
|
|
|
157
158
|
</ReqoreNotificationsWrapper>
|
|
158
159
|
) : null}
|
|
159
160
|
{children}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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',
|
|
176
181
|
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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',
|
|
186
191
|
},
|
|
187
|
-
|
|
188
|
-
},
|
|
189
|
-
]}
|
|
190
|
-
>
|
|
191
|
-
<ReqoreTextEffect
|
|
192
|
-
as='p'
|
|
193
|
-
effect={{ textAlign: 'center', weight: 'bold', textSize: 'big' }}
|
|
192
|
+
]}
|
|
194
193
|
>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
+
)}
|
|
198
202
|
</ReqoreContext.Provider>
|
|
199
203
|
</>
|
|
200
204
|
);
|
|
@@ -14,6 +14,7 @@ export interface IReqoreContext {
|
|
|
14
14
|
readonly animations?: IReqoreOptions['animations'];
|
|
15
15
|
readonly tooltips?: IReqoreOptions['tooltips'];
|
|
16
16
|
readonly closePopoversOnEscPress?: boolean;
|
|
17
|
+
readonly latestZIndex?: number;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
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
|
@@ -91,3 +91,18 @@ export const getOneLessSize = (size: TSizes): TSizes => {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
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
|
};
|
|
@@ -72,6 +72,38 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
72
72
|
</ReqoreButton>
|
|
73
73
|
</ReqoreControlGroup>
|
|
74
74
|
<br />
|
|
75
|
+
<ReqoreControlGroup fluid wrap>
|
|
76
|
+
<ReqoreButton {...buttonProps}>Left text</ReqoreButton>
|
|
77
|
+
<ReqoreButton
|
|
78
|
+
{...buttonProps}
|
|
79
|
+
textAlign='center'
|
|
80
|
+
maxWidth='250px'
|
|
81
|
+
badge='10'
|
|
82
|
+
wrap
|
|
83
|
+
description='I am a button with a center aligned text and description'
|
|
84
|
+
>
|
|
85
|
+
Center
|
|
86
|
+
</ReqoreButton>
|
|
87
|
+
<ReqoreButton
|
|
88
|
+
{...buttonProps}
|
|
89
|
+
textAlign='center'
|
|
90
|
+
maxWidth='200px'
|
|
91
|
+
badge="I'm a badge, baby"
|
|
92
|
+
wrap
|
|
93
|
+
description='I am a button with a center aligned text and description'
|
|
94
|
+
>
|
|
95
|
+
Center text with a longer text
|
|
96
|
+
</ReqoreButton>
|
|
97
|
+
<ReqoreButton
|
|
98
|
+
{...buttonProps}
|
|
99
|
+
textAlign='right'
|
|
100
|
+
badge="I'm a badge"
|
|
101
|
+
description='I am a button with a right aligned text and description'
|
|
102
|
+
>
|
|
103
|
+
Right text
|
|
104
|
+
</ReqoreButton>
|
|
105
|
+
</ReqoreControlGroup>
|
|
106
|
+
<br />
|
|
75
107
|
<ReqoreControlGroup wrap>
|
|
76
108
|
<ReqoreButton
|
|
77
109
|
{...buttonProps}
|
|
@@ -95,8 +127,22 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
95
127
|
</ReqoreButton>
|
|
96
128
|
<ReqoreButton
|
|
97
129
|
{...buttonProps}
|
|
130
|
+
minimal
|
|
98
131
|
description='This is a very interesting description for a button, I like it very much'
|
|
99
132
|
maxWidth='200px'
|
|
133
|
+
labelEffect={{
|
|
134
|
+
gradient: { colors: { 0: '#00fafd', 130: '#eb0e8c' }, direction: 'to right bottom' },
|
|
135
|
+
}}
|
|
136
|
+
descriptionEffect={{
|
|
137
|
+
gradient: { colors: { 0: '#fd7600', 90: '#c997ff' }, type: 'radial' },
|
|
138
|
+
}}
|
|
139
|
+
effect={{
|
|
140
|
+
gradient: {
|
|
141
|
+
colors: { 0: '#be00fd', 130: '#e70eeb' },
|
|
142
|
+
direction: 'to left bottom',
|
|
143
|
+
animate: 'hover',
|
|
144
|
+
},
|
|
145
|
+
}}
|
|
100
146
|
badge={{
|
|
101
147
|
effect: {
|
|
102
148
|
gradient: { colors: { 0: '#00fafd', 130: '#eb0e8c' }, direction: 'to right bottom' },
|
|
@@ -121,7 +167,18 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
121
167
|
<ReqoreButton {...buttonProps} readOnly badge={10} onClick={alert}>
|
|
122
168
|
Read only with badge
|
|
123
169
|
</ReqoreButton>
|
|
124
|
-
<ReqoreButton
|
|
170
|
+
<ReqoreButton
|
|
171
|
+
{...buttonProps}
|
|
172
|
+
minimal
|
|
173
|
+
badge={20}
|
|
174
|
+
onClick={alert}
|
|
175
|
+
effect={{
|
|
176
|
+
gradient: { colors: { 90: '#ffe69c', 0: '#ff7818' }, type: 'radial' },
|
|
177
|
+
}}
|
|
178
|
+
labelEffect={{
|
|
179
|
+
gradient: { colors: { 0: '#ffe69c', 90: '#ff7818' }, type: 'radial' },
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
125
182
|
Minimal with badge
|
|
126
183
|
</ReqoreButton>
|
|
127
184
|
<ReqoreButton
|