@qoretechnologies/reqore 0.30.4 → 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/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/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/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/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/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/helpers/colors.ts +8 -2
- package/src/helpers/utils.ts +15 -0
- package/src/stories/Button/Button.stories.tsx +58 -1
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +65 -2
- package/src/stories/Tabs/Tabs.stories.tsx +1 -0
- package/tests.json +1 -1
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { IReqoreCustomTheme, IReqoreTheme } from '../../constants/theme';
|
|
12
12
|
import ReqoreContext from '../../context/ReqoreContext';
|
|
13
13
|
import { changeLightness, getReadableColor, getReadableColorFrom } from '../../helpers/colors';
|
|
14
|
-
import { getOneLessSize } from '../../helpers/utils';
|
|
14
|
+
import { alignToFlexAlign, getOneLessSize } from '../../helpers/utils';
|
|
15
15
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
16
16
|
import { useReqoreEffect } from '../../hooks/useReqoreEffect';
|
|
17
17
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
} from '../../types/global';
|
|
34
34
|
import { IReqoreIconName } from '../../types/icons';
|
|
35
35
|
import {
|
|
36
|
+
IReqoreEffect,
|
|
36
37
|
ReqoreTextEffect,
|
|
37
38
|
StyledEffect,
|
|
38
39
|
StyledTextEffect,
|
|
@@ -70,6 +71,8 @@ export interface IReqoreButtonProps
|
|
|
70
71
|
iconColor?: TReqoreEffectColor;
|
|
71
72
|
leftIconColor?: TReqoreEffectColor;
|
|
72
73
|
rightIconColor?: TReqoreEffectColor;
|
|
74
|
+
labelEffect?: IReqoreEffect;
|
|
75
|
+
descriptionEffect?: IReqoreEffect;
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
export interface IReqoreButtonStyle extends Omit<IReqoreButtonProps, 'intent'> {
|
|
@@ -89,10 +92,13 @@ const getButtonMainColor = (theme: IReqoreTheme, color?: TReqoreHexColor) => {
|
|
|
89
92
|
export const StyledAnimatedTextWrapper = styled.span`
|
|
90
93
|
overflow: hidden;
|
|
91
94
|
position: relative;
|
|
92
|
-
text-align:
|
|
95
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-flow: column;
|
|
98
|
+
align-items: ${({ textAlign }) => alignToFlexAlign(textAlign)};
|
|
93
99
|
`;
|
|
94
100
|
|
|
95
|
-
export const StyledActiveContent = styled
|
|
101
|
+
export const StyledActiveContent = styled(StyledTextEffect)`
|
|
96
102
|
position: absolute;
|
|
97
103
|
transform: translateY(-150%);
|
|
98
104
|
opacity: 0;
|
|
@@ -112,7 +118,7 @@ export const StyledActiveContent = styled.span`
|
|
|
112
118
|
`}
|
|
113
119
|
`;
|
|
114
120
|
|
|
115
|
-
export const StyledInActiveContent = styled
|
|
121
|
+
export const StyledInActiveContent = styled(StyledTextEffect)`
|
|
116
122
|
position: absolute;
|
|
117
123
|
transform: translateY(0);
|
|
118
124
|
transition: all 0.2s ease-out;
|
|
@@ -130,7 +136,7 @@ export const StyledInActiveContent = styled.span`
|
|
|
130
136
|
`}
|
|
131
137
|
`;
|
|
132
138
|
|
|
133
|
-
export const StyledInvisibleContent = styled
|
|
139
|
+
export const StyledInvisibleContent = styled(StyledTextEffect)`
|
|
134
140
|
visibility: hidden;
|
|
135
141
|
position: relative;
|
|
136
142
|
overflow: hidden;
|
|
@@ -161,7 +167,6 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
161
167
|
|
|
162
168
|
min-height: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
163
169
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
164
|
-
width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
165
170
|
max-width: ${({ maxWidth, fluid, fixed }) => maxWidth || (fluid && !fixed ? '100%' : undefined)};
|
|
166
171
|
${({ wrap, description }) =>
|
|
167
172
|
!wrap && !description
|
|
@@ -171,6 +176,7 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
171
176
|
: null}
|
|
172
177
|
|
|
173
178
|
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
179
|
+
align-self: ${({ fixed, fluid }) => (fixed ? 'flex-start' : fluid ? 'stretch' : undefined)};
|
|
174
180
|
|
|
175
181
|
border-radius: ${({ size }) => RADIUS_FROM_SIZE[size]}px;
|
|
176
182
|
|
|
@@ -241,24 +247,32 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
241
247
|
`
|
|
242
248
|
: undefined}
|
|
243
249
|
|
|
244
|
-
${({ active, flat, theme, color }: IReqoreButtonStyle) =>
|
|
245
|
-
active
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
&:focus {
|
|
250
|
+
${({ active, flat, theme, color }: IReqoreButtonStyle) => {
|
|
251
|
+
if (active) {
|
|
252
|
+
return css`
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
background-color: ${changeLightness(getButtonMainColor(theme, color), 0.1)};
|
|
255
|
+
color: ${getReadableColor(
|
|
256
|
+
{ main: changeLightness(getButtonMainColor(theme, color), 0.1) },
|
|
257
|
+
undefined,
|
|
258
|
+
undefined
|
|
259
|
+
)};
|
|
255
260
|
border-color: ${flat
|
|
256
261
|
? undefined
|
|
257
|
-
: changeLightness(getButtonMainColor(theme, color), 0.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
: changeLightness(getButtonMainColor(theme, color), 0.175)};
|
|
263
|
+
|
|
264
|
+
&:hover,
|
|
265
|
+
&:active,
|
|
266
|
+
&:focus {
|
|
267
|
+
border-color: ${flat
|
|
268
|
+
? undefined
|
|
269
|
+
: changeLightness(getButtonMainColor(theme, color), 0.275)};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
${ActiveIconScale}
|
|
273
|
+
`;
|
|
274
|
+
}
|
|
275
|
+
}}
|
|
262
276
|
|
|
263
277
|
&:disabled {
|
|
264
278
|
${DisabledElement};
|
|
@@ -274,7 +288,7 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
274
288
|
minimal ? undefined : changeLightness(getButtonMainColor(theme, color), 0.4)};
|
|
275
289
|
}
|
|
276
290
|
|
|
277
|
-
|
|
291
|
+
.reqore-button-description {
|
|
278
292
|
padding-bottom: ${({ size }) => PADDING_FROM_SIZE[getOneLessSize(size)]}px;
|
|
279
293
|
}
|
|
280
294
|
`;
|
|
@@ -371,6 +385,8 @@ const ReqoreButton = memo(
|
|
|
371
385
|
maxWidth,
|
|
372
386
|
textAlign = 'left',
|
|
373
387
|
effect,
|
|
388
|
+
labelEffect,
|
|
389
|
+
descriptionEffect,
|
|
374
390
|
leftIconColor,
|
|
375
391
|
rightIconColor,
|
|
376
392
|
iconColor,
|
|
@@ -398,10 +414,14 @@ const ReqoreButton = memo(
|
|
|
398
414
|
return (
|
|
399
415
|
<StyledButton
|
|
400
416
|
{...rest}
|
|
401
|
-
effect={
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
417
|
+
effect={
|
|
418
|
+
intent
|
|
419
|
+
? undefined
|
|
420
|
+
: {
|
|
421
|
+
interactive: !readOnly && !rest.disabled,
|
|
422
|
+
...fixedEffect,
|
|
423
|
+
}
|
|
424
|
+
}
|
|
405
425
|
as='button'
|
|
406
426
|
theme={theme}
|
|
407
427
|
ref={targetRef}
|
|
@@ -422,7 +442,12 @@ const ReqoreButton = memo(
|
|
|
422
442
|
<StyledButtonContent size={size} wrap={wrap} description={description} flat={_flat}>
|
|
423
443
|
{icon && (
|
|
424
444
|
<>
|
|
425
|
-
<ReqoreIcon
|
|
445
|
+
<ReqoreIcon
|
|
446
|
+
icon={icon}
|
|
447
|
+
size={size}
|
|
448
|
+
color={leftIconColor || iconColor}
|
|
449
|
+
style={textAlign !== 'left' ? { marginRight: 'auto' } : undefined}
|
|
450
|
+
/>
|
|
426
451
|
{children || badge || rightIcon ? (
|
|
427
452
|
<ReqoreSpacer width={PADDING_FROM_SIZE[size]} />
|
|
428
453
|
) : null}
|
|
@@ -430,9 +455,15 @@ const ReqoreButton = memo(
|
|
|
430
455
|
)}
|
|
431
456
|
{children && (
|
|
432
457
|
<StyledAnimatedTextWrapper textAlign={textAlign}>
|
|
433
|
-
<StyledActiveContent wrap={wrap}
|
|
434
|
-
|
|
435
|
-
|
|
458
|
+
<StyledActiveContent wrap={wrap} effect={labelEffect}>
|
|
459
|
+
{children}
|
|
460
|
+
</StyledActiveContent>
|
|
461
|
+
<StyledInActiveContent wrap={wrap} effect={labelEffect}>
|
|
462
|
+
{children}
|
|
463
|
+
</StyledInActiveContent>
|
|
464
|
+
<StyledInvisibleContent wrap={wrap} effect={labelEffect}>
|
|
465
|
+
{children}
|
|
466
|
+
</StyledInvisibleContent>
|
|
436
467
|
{(badge || badge === 0) && wrap ? (
|
|
437
468
|
<ButtonBadge content={badge} size={size} color={color} wrap />
|
|
438
469
|
) : null}
|
|
@@ -447,7 +478,7 @@ const ReqoreButton = memo(
|
|
|
447
478
|
<ReqoreIcon
|
|
448
479
|
icon={rightIcon}
|
|
449
480
|
size={size}
|
|
450
|
-
style={{ marginLeft: 'auto' }}
|
|
481
|
+
style={textAlign !== 'right' ? { marginLeft: 'auto' } : undefined}
|
|
451
482
|
color={rightIconColor || iconColor}
|
|
452
483
|
/>
|
|
453
484
|
</>
|
|
@@ -456,11 +487,13 @@ const ReqoreButton = memo(
|
|
|
456
487
|
|
|
457
488
|
{description && (
|
|
458
489
|
<ReqoreTextEffect
|
|
490
|
+
className='reqore-button-description'
|
|
459
491
|
effect={{
|
|
460
492
|
textSize: getOneLessSize(size),
|
|
461
493
|
weight: 'light',
|
|
462
494
|
color: `${color}90`,
|
|
463
495
|
textAlign,
|
|
496
|
+
...descriptionEffect,
|
|
464
497
|
}}
|
|
465
498
|
>
|
|
466
499
|
{description}
|
|
@@ -137,7 +137,8 @@ const StyledCheckbox = styled.div<IReqoreCheckboxStyle>`
|
|
|
137
137
|
height: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
138
138
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
max-width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
141
|
+
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
141
142
|
|
|
142
143
|
${({ disabled }) =>
|
|
143
144
|
disabled &&
|
|
@@ -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}
|
|
@@ -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}
|
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
|
+
};
|
|
@@ -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
|