@qoretechnologies/reqore 0.26.1 → 0.27.1

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.
Files changed (110) hide show
  1. package/__tests__/panel.test.tsx +3 -3
  2. package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
  3. package/dist/components/Breadcrumbs/index.js +1 -1
  4. package/dist/components/Breadcrumbs/index.js.map +1 -1
  5. package/dist/components/Button/index.d.ts +7 -1
  6. package/dist/components/Button/index.d.ts.map +1 -1
  7. package/dist/components/Button/index.js +45 -20
  8. package/dist/components/Button/index.js.map +1 -1
  9. package/dist/components/Collection/index.d.ts.map +1 -1
  10. package/dist/components/Collection/index.js +9 -1
  11. package/dist/components/Collection/index.js.map +1 -1
  12. package/dist/components/Collection/item.js +1 -1
  13. package/dist/components/Collection/item.js.map +1 -1
  14. package/dist/components/Drawer/index.d.ts.map +1 -1
  15. package/dist/components/Drawer/index.js +3 -1
  16. package/dist/components/Drawer/index.js.map +1 -1
  17. package/dist/components/Effect/index.d.ts +10 -2
  18. package/dist/components/Effect/index.d.ts.map +1 -1
  19. package/dist/components/Effect/index.js +20 -11
  20. package/dist/components/Effect/index.js.map +1 -1
  21. package/dist/components/Header/index.d.ts +2 -1
  22. package/dist/components/Header/index.d.ts.map +1 -1
  23. package/dist/components/Header/index.js +6 -5
  24. package/dist/components/Header/index.js.map +1 -1
  25. package/dist/components/Menu/divider.d.ts +2 -1
  26. package/dist/components/Menu/divider.d.ts.map +1 -1
  27. package/dist/components/Menu/divider.js +4 -3
  28. package/dist/components/Menu/divider.js.map +1 -1
  29. package/dist/components/Menu/index.d.ts +1 -0
  30. package/dist/components/Menu/index.d.ts.map +1 -1
  31. package/dist/components/Menu/index.js +3 -2
  32. package/dist/components/Menu/index.js.map +1 -1
  33. package/dist/components/Menu/item.d.ts.map +1 -1
  34. package/dist/components/Menu/item.js +2 -2
  35. package/dist/components/Menu/item.js.map +1 -1
  36. package/dist/components/Panel/index.d.ts +2 -1
  37. package/dist/components/Panel/index.d.ts.map +1 -1
  38. package/dist/components/Panel/index.js +22 -12
  39. package/dist/components/Panel/index.js.map +1 -1
  40. package/dist/components/Spacer/index.d.ts.map +1 -1
  41. package/dist/components/Spacer/index.js +1 -1
  42. package/dist/components/Spacer/index.js.map +1 -1
  43. package/dist/components/Tabs/index.js +2 -2
  44. package/dist/components/Tabs/index.js.map +1 -1
  45. package/dist/components/Tabs/item.d.ts +2 -1
  46. package/dist/components/Tabs/item.d.ts.map +1 -1
  47. package/dist/components/Tabs/item.js +2 -2
  48. package/dist/components/Tabs/item.js.map +1 -1
  49. package/dist/components/Tabs/list.d.ts.map +1 -1
  50. package/dist/components/Tabs/list.js +1 -1
  51. package/dist/components/Tabs/list.js.map +1 -1
  52. package/dist/components/Tag/index.d.ts.map +1 -1
  53. package/dist/components/Tag/index.js +3 -3
  54. package/dist/components/Tag/index.js.map +1 -1
  55. package/dist/constants/animations.d.ts +4 -0
  56. package/dist/constants/animations.d.ts.map +1 -1
  57. package/dist/constants/animations.js +5 -1
  58. package/dist/constants/animations.js.map +1 -1
  59. package/dist/constants/sizes.d.ts +21 -0
  60. package/dist/constants/sizes.d.ts.map +1 -1
  61. package/dist/constants/sizes.js +22 -1
  62. package/dist/constants/sizes.js.map +1 -1
  63. package/dist/containers/ReqoreProvider.js +1 -1
  64. package/dist/containers/ReqoreProvider.js.map +1 -1
  65. package/dist/containers/UIProvider.d.ts +1 -0
  66. package/dist/containers/UIProvider.d.ts.map +1 -1
  67. package/dist/containers/UIProvider.js.map +1 -1
  68. package/dist/context/ReqoreContext.d.ts.map +1 -1
  69. package/dist/context/ReqoreContext.js +2 -1
  70. package/dist/context/ReqoreContext.js.map +1 -1
  71. package/dist/helpers/colors.d.ts +1 -0
  72. package/dist/helpers/colors.d.ts.map +1 -1
  73. package/dist/helpers/colors.js +11 -1
  74. package/dist/helpers/colors.js.map +1 -1
  75. package/dist/helpers/utils.d.ts +2 -0
  76. package/dist/helpers/utils.d.ts.map +1 -1
  77. package/dist/helpers/utils.js +11 -1
  78. package/dist/helpers/utils.js.map +1 -1
  79. package/package.json +1 -1
  80. package/src/components/Breadcrumbs/index.tsx +1 -0
  81. package/src/components/Button/index.tsx +156 -86
  82. package/src/components/Collection/index.tsx +10 -11
  83. package/src/components/Collection/item.tsx +1 -1
  84. package/src/components/Drawer/index.tsx +5 -3
  85. package/src/components/Effect/index.tsx +34 -3
  86. package/src/components/Header/index.tsx +16 -11
  87. package/src/components/Menu/divider.tsx +17 -9
  88. package/src/components/Menu/index.tsx +13 -1
  89. package/src/components/Menu/item.tsx +3 -2
  90. package/src/components/Panel/index.tsx +36 -9
  91. package/src/components/Spacer/index.tsx +1 -0
  92. package/src/components/Tabs/index.tsx +1 -1
  93. package/src/components/Tabs/item.tsx +7 -3
  94. package/src/components/Tabs/list.tsx +1 -0
  95. package/src/components/Tag/index.tsx +3 -2
  96. package/src/constants/animations.ts +5 -0
  97. package/src/constants/sizes.ts +24 -0
  98. package/src/containers/ReqoreProvider.tsx +1 -1
  99. package/src/containers/UIProvider.tsx +1 -0
  100. package/src/context/ReqoreContext.tsx +1 -0
  101. package/src/helpers/colors.ts +15 -0
  102. package/src/helpers/utils.ts +10 -0
  103. package/src/mock/collectionData.tsx +2 -2
  104. package/src/stories/Button/Button.stories.tsx +69 -1
  105. package/src/stories/Dropdown/Dropdown.stories.tsx +2 -0
  106. package/src/stories/Menu/Menu.stories.tsx +36 -8
  107. package/src/stories/Panel/Panel.stories.tsx +8 -5
  108. package/src/stories/Tabs/Tabs.stories.tsx +10 -5
  109. package/src/stories/Tag/Tag.stories.tsx +42 -4
  110. package/tests.json +1 -1
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, useContext } from 'react';
1
+ import React, { forwardRef, memo, useContext } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import {
4
4
  PADDING_FROM_SIZE,
@@ -10,6 +10,7 @@ import {
10
10
  import { IReqoreCustomTheme, IReqoreTheme } from '../../constants/theme';
11
11
  import ReqoreContext from '../../context/ReqoreContext';
12
12
  import { changeLightness, getReadableColor, getReadableColorFrom } from '../../helpers/colors';
13
+ import { getOneLessSize } from '../../helpers/utils';
13
14
  import { useCombinedRefs } from '../../hooks/useCombinedRefs';
14
15
  import { useReqoreTheme } from '../../hooks/useTheme';
15
16
  import { useTooltip } from '../../hooks/useTooltip';
@@ -28,8 +29,10 @@ import {
28
29
  TReqoreTooltipProp,
29
30
  } from '../../types/global';
30
31
  import { IReqoreIconName } from '../../types/icons';
31
- import { StyledEffect } from '../Effect';
32
+ import { ReqoreTextEffect, StyledEffect, StyledTextEffect } from '../Effect';
32
33
  import ReqoreIcon from '../Icon';
34
+ import { ReqoreSpacer } from '../Spacer';
35
+ import ReqoreTag, { IReqoreTagProps } from '../Tag';
33
36
 
34
37
  export interface IReqoreButtonProps
35
38
  extends React.HTMLAttributes<HTMLButtonElement>,
@@ -48,6 +51,10 @@ export interface IReqoreButtonProps
48
51
  rightIcon?: IReqoreIconName;
49
52
  customTheme?: IReqoreCustomTheme;
50
53
  wrap?: boolean;
54
+ badge?: string | number | IReqoreTagProps;
55
+ description?: string | number;
56
+ maxWidth?: string;
57
+ textAlign?: 'left' | 'center' | 'right';
51
58
  }
52
59
 
53
60
  export interface IReqoreButtonStyle extends Omit<IReqoreButtonProps, 'intent'> {
@@ -67,6 +74,7 @@ export const StyledAnimatedTextWrapper = styled.span`
67
74
  overflow: hidden;
68
75
  position: relative;
69
76
  padding: 4px 0;
77
+ text-align: left;
70
78
  `;
71
79
 
72
80
  export const StyledActiveContent = styled.span`
@@ -77,7 +85,7 @@ export const StyledActiveContent = styled.span`
77
85
  filter: blur(10px);
78
86
 
79
87
  ${({ wrap }) =>
80
- wrap &&
88
+ !wrap &&
81
89
  css`
82
90
  overflow: hidden;
83
91
  text-overflow: ellipsis;
@@ -92,7 +100,7 @@ export const StyledInActiveContent = styled.span`
92
100
  transition: all 0.2s ease-out;
93
101
 
94
102
  ${({ wrap }) =>
95
- wrap &&
103
+ !wrap &&
96
104
  css`
97
105
  overflow: hidden;
98
106
  text-overflow: ellipsis;
@@ -107,7 +115,7 @@ export const StyledInvisibleContent = styled.span`
107
115
  overflow: hidden;
108
116
 
109
117
  ${({ wrap }) =>
110
- wrap &&
118
+ !wrap &&
111
119
  css`
112
120
  white-space: nowrap;
113
121
  `}
@@ -115,8 +123,8 @@ export const StyledInvisibleContent = styled.span`
115
123
 
116
124
  export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
117
125
  display: flex;
118
- text-align: left;
119
- align-items: center;
126
+ flex-flow: column;
127
+ justify-content: center;
120
128
  margin: 0;
121
129
  font-weight: 600;
122
130
  position: relative;
@@ -129,13 +137,8 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
129
137
 
130
138
  min-height: ${({ size }) => SIZE_TO_PX[size]}px;
131
139
 
132
- ${({ wrap }) =>
133
- wrap &&
134
- css`
135
- max-height: ${({ size }) => SIZE_TO_PX[size]}px;
136
- `}
137
-
138
140
  min-width: ${({ size }) => SIZE_TO_PX[size]}px;
141
+ max-width: ${({ maxWidth }) => maxWidth || undefined};
139
142
 
140
143
  flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 0 auto')};
141
144
 
@@ -233,82 +236,149 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
233
236
  border-color: ${({ minimal, theme, color }) =>
234
237
  minimal ? undefined : changeLightness(getButtonMainColor(theme, color), 0.4)};
235
238
  }
239
+
240
+ ${StyledTextEffect} {
241
+ padding-bottom: ${({ size }) => PADDING_FROM_SIZE[getOneLessSize(size)]}px;
242
+ }
236
243
  `;
237
244
 
238
- const ReqoreButton = forwardRef(
239
- (
240
- {
241
- icon,
242
- size = 'normal',
243
- minimal,
244
- children,
245
- tooltip,
246
- className,
247
- fluid,
248
- fixed,
249
- intent,
250
- active,
251
- flat,
252
- rightIcon,
253
- customTheme,
254
- wrap = true,
255
- readOnly,
256
- ...rest
257
- }: IReqoreButtonProps,
258
- ref
259
- ) => {
260
- const { targetRef } = useCombinedRefs(ref);
261
- const { animations } = useContext(ReqoreContext);
262
- const theme: IReqoreTheme = useReqoreTheme('main', customTheme, intent);
263
-
264
- /* A custom hook that is used to add a tooltip to the button. */
265
- useTooltip(targetRef.current, tooltip);
266
-
267
- // If color or intent was specified, set the color
268
- const customColor = theme.main;
269
- const _flat = minimal ? flat : flat !== false;
270
-
271
- return (
272
- <StyledButton
273
- {...rest}
274
- as='button'
275
- theme={theme}
276
- ref={targetRef}
277
- fluid={fluid}
278
- fixed={fixed}
279
- minimal={minimal}
280
- size={size}
281
- color={customColor}
282
- animate={animations.buttons}
283
- flat={_flat}
284
- active={active}
285
- readOnly={readOnly}
286
- className={`${className || ''} reqore-control reqore-button`}
287
- >
288
- {icon && (
289
- <ReqoreIcon
290
- icon={icon}
291
- margin={children || rightIcon ? 'right' : undefined}
292
- size={`${TEXT_FROM_SIZE[size]}px`}
293
- />
294
- )}
295
- {children && (
296
- <StyledAnimatedTextWrapper>
297
- <StyledActiveContent wrap={wrap}>{children}</StyledActiveContent>
298
- <StyledInActiveContent wrap={wrap}>{children}</StyledInActiveContent>
299
- <StyledInvisibleContent wrap={wrap}>{children}</StyledInvisibleContent>
300
- </StyledAnimatedTextWrapper>
301
- )}
302
- {rightIcon && (
303
- <ReqoreIcon
304
- icon={rightIcon}
305
- margin={children ? 'left' : undefined}
306
- size={`${TEXT_FROM_SIZE[size]}px`}
245
+ export const StyledButtonContent = styled.div`
246
+ display: flex;
247
+ align-items: center;
248
+ width: 100%;
249
+ height: 100%;
250
+ flex: 1;
251
+ flex-shrink: 0;
252
+ min-height: ${({ size }) => SIZE_TO_PX[size]}px;
253
+ ${({ wrap, description }) =>
254
+ !wrap && !description
255
+ ? css`
256
+ max-height: ${({ size }) => SIZE_TO_PX[size]}px;
257
+ `
258
+ : null}
259
+ `;
260
+
261
+ const ReqoreButton = memo(
262
+ forwardRef(
263
+ (
264
+ {
265
+ icon,
266
+ size = 'normal',
267
+ minimal,
268
+ children,
269
+ tooltip,
270
+ className,
271
+ fluid,
272
+ fixed,
273
+ intent,
274
+ active,
275
+ flat,
276
+ rightIcon,
277
+ customTheme,
278
+ wrap,
279
+ readOnly,
280
+ badge,
281
+ description,
282
+ maxWidth,
283
+ textAlign = 'left',
284
+ ...rest
285
+ }: IReqoreButtonProps,
286
+ ref
287
+ ) => {
288
+ const { targetRef } = useCombinedRefs(ref);
289
+ const { animations } = useContext(ReqoreContext);
290
+ const theme: IReqoreTheme = useReqoreTheme('main', customTheme, intent);
291
+
292
+ /* A custom hook that is used to add a tooltip to the button. */
293
+ useTooltip(targetRef.current, tooltip);
294
+
295
+ // If color or intent was specified, set the color
296
+ const customColor = theme.main;
297
+ const _flat = minimal ? flat : flat !== false;
298
+ const color = customColor
299
+ ? minimal
300
+ ? getReadableColor(theme, undefined, undefined, true, theme.originalMain)
301
+ : getReadableColorFrom(customColor, true)
302
+ : getReadableColor(theme, undefined, undefined, true);
303
+
304
+ const renderBadge = () => (
305
+ <>
306
+ <ReqoreSpacer width={PADDING_FROM_SIZE[size]} />
307
+ <ReqoreTag
308
+ size={getOneLessSize(size)}
309
+ badge
310
+ color={`${color}70`}
311
+ {...(typeof badge === 'string' || typeof badge === 'number' ? { label: badge } : badge)}
307
312
  />
308
- )}
309
- </StyledButton>
310
- );
311
- }
313
+ </>
314
+ );
315
+
316
+ return (
317
+ <StyledButton
318
+ {...rest}
319
+ as='button'
320
+ theme={theme}
321
+ ref={targetRef}
322
+ fluid={fluid}
323
+ fixed={fixed}
324
+ maxWidth={maxWidth}
325
+ minimal={minimal}
326
+ size={size}
327
+ color={customColor}
328
+ animate={animations.buttons}
329
+ flat={_flat}
330
+ active={active}
331
+ readOnly={readOnly}
332
+ wrap={wrap}
333
+ description={description}
334
+ className={`${className || ''} reqore-control reqore-button`}
335
+ >
336
+ <StyledButtonContent size={size} wrap={wrap} description={description}>
337
+ {icon && (
338
+ <>
339
+ <ReqoreIcon icon={icon} size={`${TEXT_FROM_SIZE[size]}px`} />
340
+ {children || badge || rightIcon ? (
341
+ <ReqoreSpacer width={PADDING_FROM_SIZE[size]} />
342
+ ) : null}
343
+ </>
344
+ )}
345
+ {children && (
346
+ <StyledAnimatedTextWrapper textAlign={textAlign}>
347
+ <StyledActiveContent wrap={wrap}>{children}</StyledActiveContent>
348
+ <StyledInActiveContent wrap={wrap}>{children}</StyledInActiveContent>
349
+ <StyledInvisibleContent wrap={wrap}>{children}</StyledInvisibleContent>
350
+ {badge && wrap ? renderBadge() : null}
351
+ </StyledAnimatedTextWrapper>
352
+ )}
353
+ {badge && !wrap ? renderBadge() : null}
354
+ {rightIcon && (
355
+ <>
356
+ {children || badge ? <ReqoreSpacer width={PADDING_FROM_SIZE[size]} /> : null}
357
+ <ReqoreIcon
358
+ icon={rightIcon}
359
+ size={`${TEXT_FROM_SIZE[size]}px`}
360
+ style={{ marginLeft: 'auto' }}
361
+ />
362
+ </>
363
+ )}
364
+ </StyledButtonContent>
365
+
366
+ {description && (
367
+ <ReqoreTextEffect
368
+ effect={{
369
+ textSize: getOneLessSize(size),
370
+ weight: 'light',
371
+ color: `${color}90`,
372
+ textAlign,
373
+ }}
374
+ >
375
+ {description}
376
+ </ReqoreTextEffect>
377
+ )}
378
+ </StyledButton>
379
+ );
380
+ }
381
+ )
312
382
  );
313
383
 
314
384
  export default ReqoreButton;
@@ -82,22 +82,21 @@ export const ReqoreCollection = ({
82
82
 
83
83
  const finalItems = filteredItems;
84
84
  const finalActions: (IReqorePanelAction[] | IReqorePanelAction)[] = useMemo(() => {
85
- let actions = [];
85
+ let actions: (IReqorePanelAction[] | IReqorePanelAction)[] = [];
86
86
 
87
87
  if (filterable) {
88
88
  actions = [
89
89
  ...actions,
90
90
  {
91
- customContent: () => (
92
- <ReqoreInput
93
- placeholder={`Filter ${size(items)} items`}
94
- onClearClick={() => setQuery('')}
95
- onChange={handleQueryChange}
96
- value={query}
97
- icon='Search2Line'
98
- minimal={false}
99
- />
100
- ),
91
+ as: ReqoreInput,
92
+ props: {
93
+ placeholder: `Filter ${size(items)} items`,
94
+ onClearClick: () => setQuery(''),
95
+ onChange: handleQueryChange,
96
+ value: query,
97
+ icon: 'Search2Line',
98
+ minimal: false,
99
+ },
101
100
  },
102
101
  ];
103
102
  }
@@ -86,7 +86,7 @@ export const ReqoreCollectionItem = ({
86
86
  const [contentRef, sizes] = useMeasure();
87
87
  const originalDimensions = useRef(null);
88
88
  const [position, setPosition] = useState(undefined);
89
- const theme = useReqoreTheme('main', rest.customTheme, rest.intent);
89
+ const theme = useReqoreTheme('main', rest.customTheme);
90
90
  const [dimensions, setDimensions] = useState<any>({
91
91
  minWidth: undefined,
92
92
  minHeight: undefined,
@@ -1,10 +1,11 @@
1
1
  import { animated, useTransition } from '@react-spring/web';
2
2
  import { rgba } from 'polished';
3
3
  import { Resizable } from 're-resizable';
4
- import { useEffect, useMemo, useState } from 'react';
4
+ import { useContext, useEffect, useMemo, useState } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import styled, { css } from 'styled-components';
7
- import { SPRING_CONFIG } from '../../constants/animations';
7
+ import { ReqoreContext } from '../..';
8
+ import { SPRING_CONFIG, SPRING_CONFIG_NO_ANIMATIONS } from '../../constants/animations';
8
9
  import { IReqoreTheme } from '../../constants/theme';
9
10
  import ReqoreThemeProvider from '../../containers/ThemeProvider';
10
11
  import { getMainBackgroundColor } from '../../helpers/colors';
@@ -171,6 +172,7 @@ export const ReqoreDrawer = ({
171
172
  height,
172
173
  ...rest
173
174
  }: IReqoreDrawerProps) => {
175
+ const { animations } = useContext(ReqoreContext);
174
176
  const theme = useReqoreTheme('main', customTheme, intent);
175
177
  const layout = useMemo(
176
178
  () =>
@@ -192,7 +194,7 @@ export const ReqoreDrawer = ({
192
194
 
193
195
  const transitions = useTransition(isOpen, {
194
196
  ...getSpringConfig(_isModal, position, floating),
195
- config: SPRING_CONFIG,
197
+ config: animations.dialogs ? SPRING_CONFIG : SPRING_CONFIG_NO_ANIMATIONS,
196
198
  });
197
199
 
198
200
  const zIndex = useLatestZIndex();
@@ -1,7 +1,9 @@
1
1
  import { reduce } from 'lodash';
2
+ import { HTMLAttributes } from 'react';
2
3
  import styled, { css } from 'styled-components';
3
4
  import { TEXT_FROM_SIZE, TSizes, WEIGHT_TO_NUMBER } from '../../constants/sizes';
4
- import { changeDarkness } from '../../helpers/colors';
5
+ import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
6
+ import { changeDarkness, getColorFromMaybeIntentOrString } from '../../helpers/colors';
5
7
 
6
8
  export interface IReqoreEffect {
7
9
  gradient?: {
@@ -17,15 +19,24 @@ export interface IReqoreEffect {
17
19
  uppercase?: boolean;
18
20
  textSize?: TSizes;
19
21
  textAlign?: 'left' | 'center' | 'right';
22
+ glow?: {
23
+ size?: number;
24
+ color: TReqoreIntent | string;
25
+ inset?: boolean;
26
+ useBorder?: boolean;
27
+ };
20
28
  }
21
29
 
22
- export interface IReqoreTextEffectProps extends React.HTMLAttributes<HTMLSpanElement> {
30
+ export interface IReqoreTextEffectProps extends HTMLAttributes<HTMLSpanElement> {
23
31
  children: React.ReactNode;
24
32
  effect: IReqoreEffect;
25
33
  as?: React.ElementType;
34
+ theme?: IReqoreTheme;
26
35
  }
27
36
 
28
37
  export const StyledEffect = styled.span`
38
+ transition: all 0.2s ease-in-out;
39
+
29
40
  // If gradient was supplied
30
41
  ${({ effect }: IReqoreTextEffectProps) => {
31
42
  if (!effect || !effect.gradient) {
@@ -51,6 +62,24 @@ export const StyledEffect = styled.span`
51
62
  `;
52
63
  }}
53
64
 
65
+ ${({ effect, theme }: IReqoreTextEffectProps) => {
66
+ if (!effect || !effect.glow) {
67
+ return undefined;
68
+ }
69
+
70
+ if (effect.glow.useBorder) {
71
+ return css`
72
+ border: ${effect.glow.size || 2}px solid
73
+ ${getColorFromMaybeIntentOrString(theme, effect.glow.color)} !important;
74
+ `;
75
+ }
76
+
77
+ return css`
78
+ box-shadow: ${effect.glow.inset ? 'inset ' : ''} 0 0 0 ${effect.glow.size || 2}px
79
+ ${getColorFromMaybeIntentOrString(theme, effect.glow.color)};
80
+ `;
81
+ }}
82
+
54
83
  ${({ effect }: IReqoreTextEffectProps) =>
55
84
  effect && effect.spaced
56
85
  ? css`
@@ -104,16 +133,18 @@ export const StyledEffect = styled.span`
104
133
  ${({ effect }: IReqoreTextEffectProps) =>
105
134
  effect && effect.textAlign
106
135
  ? css`
136
+ width: 100%;
107
137
  text-align: ${effect.textAlign};
108
138
  `
109
139
  : undefined}
110
140
  `;
111
141
 
112
142
  export const StyledTextEffect = styled(StyledEffect)`
143
+ display: inline-block;
144
+
113
145
  ${({ effect }: IReqoreTextEffectProps) =>
114
146
  effect && effect.gradient
115
147
  ? css`
116
- display: inline-block;
117
148
  -webkit-background-clip: text;
118
149
  -webkit-text-fill-color: transparent;
119
150
  `
@@ -1,7 +1,8 @@
1
- import { useMemo } from 'react';
1
+ import { memo, useMemo } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
4
4
  import { getReadableColor } from '../../helpers/colors';
5
+ import { useReqoreTheme } from '../../hooks/useTheme';
5
6
  import { IWithReqoreEffect } from '../../types/global';
6
7
  import { StyledTextEffect } from '../Effect';
7
8
 
@@ -10,6 +11,7 @@ export interface IReqoreHeadingProps
10
11
  React.HTMLAttributes<HTMLHeadingElement> {
11
12
  intent?: TReqoreIntent;
12
13
  size?: 1 | 2 | 3 | 4 | 5 | 6;
14
+ customTheme?: Partial<IReqoreTheme>;
13
15
  }
14
16
 
15
17
  export interface IReqoreHeadingStyle extends IReqoreHeadingProps {
@@ -23,17 +25,20 @@ export const StyledHeader = styled(StyledTextEffect)`
23
25
  intent ? theme.intents[intent] : getReadableColor(theme, undefined, undefined, true)};
24
26
  `;
25
27
 
26
- export const ReqoreHeading = ({ size, children, ...props }: IReqoreHeadingProps) => {
27
- const HTMLheaderElement = useMemo(() => {
28
- return `h${size}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
29
- }, [size]);
28
+ export const ReqoreHeading = memo(
29
+ ({ size, children, customTheme, intent, ...props }: IReqoreHeadingProps) => {
30
+ const theme = useReqoreTheme('main', customTheme, intent);
31
+ const HTMLheaderElement = useMemo(() => {
32
+ return `h${size}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
33
+ }, [size]);
30
34
 
31
- return (
32
- <StyledHeader as={HTMLheaderElement} {...props}>
33
- {children}
34
- </StyledHeader>
35
- );
36
- };
35
+ return (
36
+ <StyledHeader as={HTMLheaderElement} theme={theme} intent={intent} {...props}>
37
+ {children}
38
+ </StyledHeader>
39
+ );
40
+ }
41
+ );
37
42
 
38
43
  export const ReqoreH1 = (props: IReqoreHeadingProps) => <ReqoreHeading size={1} {...props} />;
39
44
  export const ReqoreH2 = (props: IReqoreHeadingProps) => <ReqoreHeading size={2} {...props} />;
@@ -1,32 +1,40 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
- import { IReqoreTheme } from '../../constants/theme';
4
3
  import { getReadableColor } from '../../helpers/colors';
4
+ import { IWithReqoreEffect } from '../../types/global';
5
+ import { IReqoreEffect, StyledTextEffect } from '../Effect';
5
6
 
6
7
  export interface IReqoreMenuDividerProps
7
- extends React.HTMLAttributes<HTMLDivElement> {
8
+ extends React.HTMLAttributes<HTMLDivElement>,
9
+ IWithReqoreEffect {
8
10
  label?: string;
9
11
  }
10
12
 
11
- const StyledMenuDivider = styled.div<{ theme: IReqoreTheme }>`
13
+ const StyledMenuDivider = styled(StyledTextEffect)`
12
14
  width: 100%;
13
15
  padding: 8px 0;
14
16
  background-color: ${({ theme }) => theme.main};
15
- font-size: 11px;
16
- text-transform: uppercase;
17
- text-align: center;
18
- letter-spacing: 2px;
19
- font-weight: 600;
20
17
 
21
18
  color: ${({ theme }) => getReadableColor(theme, undefined, undefined)};
22
19
  `;
23
20
 
24
21
  const ReqoreMenuDivider = forwardRef(
25
- ({ label, className, ...rest }: IReqoreMenuDividerProps, ref: any) => (
22
+ ({ label, className, effect, ...rest }: IReqoreMenuDividerProps, ref: any) => (
26
23
  <StyledMenuDivider
24
+ as='div'
27
25
  {...rest}
28
26
  className={`${className || ''} reqore-menu-divider`}
29
27
  ref={ref}
28
+ effect={
29
+ {
30
+ uppercase: true,
31
+ spaced: 2,
32
+ textAlign: 'center',
33
+ textSize: 'small',
34
+ weight: 'bold',
35
+ ...effect,
36
+ } as IReqoreEffect
37
+ }
30
38
  >
31
39
  {label}
32
40
  </StyledMenuDivider>
@@ -15,6 +15,7 @@ export interface IReqoreMenuProps extends IReqoreComponent, React.HTMLAttributes
15
15
  customTheme?: IReqoreCustomTheme;
16
16
  intent?: TReqoreIntent;
17
17
  wrapText?: boolean;
18
+ flat?: boolean;
18
19
  }
19
20
 
20
21
  export interface IReqoreMenuStyle extends IReqoreMenuProps {
@@ -48,7 +49,17 @@ const StyledReqoreMenu = styled.div<IReqoreMenuStyle>`
48
49
 
49
50
  const ReqoreMenu: React.FC<IReqoreMenuProps> = forwardRef(
50
51
  (
51
- { children, position, _insidePopover, _popoverId, customTheme, intent, wrapText, ...rest },
52
+ {
53
+ children,
54
+ position,
55
+ _insidePopover,
56
+ _popoverId,
57
+ customTheme,
58
+ intent,
59
+ wrapText,
60
+ flat = true,
61
+ ...rest
62
+ },
52
63
  ref: any
53
64
  ) => {
54
65
  const theme = useReqoreTheme('main', customTheme, intent);
@@ -64,6 +75,7 @@ const ReqoreMenu: React.FC<IReqoreMenuProps> = forwardRef(
64
75
  _popoverId,
65
76
  customTheme: theme,
66
77
  wrap: wrapText,
78
+ flat,
67
79
  })
68
80
  : null
69
81
  )}
@@ -50,6 +50,7 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
50
50
  _popoverId,
51
51
  tooltip,
52
52
  intent,
53
+ flat = true,
53
54
  ...rest
54
55
  },
55
56
  ref: any
@@ -88,7 +89,7 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
88
89
  //@ts-ignore
89
90
  as={as}
90
91
  {...rest}
91
- flat
92
+ flat={flat}
92
93
  className='reqore-menu-item'
93
94
  fluid
94
95
  onClick={handleClick}
@@ -103,7 +104,7 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
103
104
  {rightIcon && (
104
105
  <ReqoreButton
105
106
  icon={rightIcon}
106
- flat
107
+ flat={flat}
107
108
  fixed
108
109
  minimal={!onRightIconClick}
109
110
  customTheme={rest.customTheme}