@qoretechnologies/reqore 0.20.7 → 0.22.0

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 (125) hide show
  1. package/__tests__/dropdown.test.tsx +1 -1
  2. package/__tests__/table.test.tsx +20 -18
  3. package/dist/components/Breadcrumbs/index.d.ts +2 -2
  4. package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
  5. package/dist/components/Breadcrumbs/item.d.ts.map +1 -1
  6. package/dist/components/Breadcrumbs/item.js +3 -4
  7. package/dist/components/Breadcrumbs/item.js.map +1 -1
  8. package/dist/components/Button/index.d.ts +3 -7
  9. package/dist/components/Button/index.d.ts.map +1 -1
  10. package/dist/components/Button/index.js +28 -19
  11. package/dist/components/Button/index.js.map +1 -1
  12. package/dist/components/Checkbox/index.d.ts +3 -4
  13. package/dist/components/Checkbox/index.d.ts.map +1 -1
  14. package/dist/components/Checkbox/index.js +35 -12
  15. package/dist/components/Checkbox/index.js.map +1 -1
  16. package/dist/components/Comment/index.d.ts +2 -2
  17. package/dist/components/ControlGroup/index.d.ts +1 -0
  18. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  19. package/dist/components/ControlGroup/index.js +3 -2
  20. package/dist/components/ControlGroup/index.js.map +1 -1
  21. package/dist/components/Header/index.d.ts +2 -2
  22. package/dist/components/Header/index.d.ts.map +1 -1
  23. package/dist/components/Icon/index.d.ts +2 -2
  24. package/dist/components/Input/index.d.ts +2 -4
  25. package/dist/components/Input/index.d.ts.map +1 -1
  26. package/dist/components/Input/index.js +57 -28
  27. package/dist/components/Input/index.js.map +1 -1
  28. package/dist/components/Menu/index.d.ts +3 -2
  29. package/dist/components/Menu/index.d.ts.map +1 -1
  30. package/dist/components/Menu/index.js +7 -4
  31. package/dist/components/Menu/index.js.map +1 -1
  32. package/dist/components/Menu/item.d.ts +7 -6
  33. package/dist/components/Menu/item.d.ts.map +1 -1
  34. package/dist/components/Menu/item.js +9 -67
  35. package/dist/components/Menu/item.js.map +1 -1
  36. package/dist/components/Message/index.d.ts +2 -2
  37. package/dist/components/Message/index.d.ts.map +1 -1
  38. package/dist/components/Navbar/item.d.ts.map +1 -1
  39. package/dist/components/Navbar/item.js +12 -5
  40. package/dist/components/Navbar/item.js.map +1 -1
  41. package/dist/components/Notifications/notification.d.ts +4 -4
  42. package/dist/components/Notifications/notification.d.ts.map +1 -1
  43. package/dist/components/Panel/index.d.ts +3 -3
  44. package/dist/components/Panel/index.d.ts.map +1 -1
  45. package/dist/components/Paragraph/index.d.ts +2 -2
  46. package/dist/components/Paragraph/index.d.ts.map +1 -1
  47. package/dist/components/Sidebar/index.d.ts.map +1 -1
  48. package/dist/components/Sidebar/index.js +7 -6
  49. package/dist/components/Sidebar/index.js.map +1 -1
  50. package/dist/components/Table/index.d.ts +10 -11
  51. package/dist/components/Table/index.d.ts.map +1 -1
  52. package/dist/components/Table/index.js +5 -4
  53. package/dist/components/Table/index.js.map +1 -1
  54. package/dist/components/Table/row.d.ts +6 -6
  55. package/dist/components/Table/row.d.ts.map +1 -1
  56. package/dist/components/Tabs/index.d.ts +5 -5
  57. package/dist/components/Tabs/item.d.ts.map +1 -1
  58. package/dist/components/Tabs/item.js +2 -3
  59. package/dist/components/Tabs/item.js.map +1 -1
  60. package/dist/components/Tag/index.d.ts +5 -10
  61. package/dist/components/Tag/index.d.ts.map +1 -1
  62. package/dist/components/Tag/index.js +10 -7
  63. package/dist/components/Tag/index.js.map +1 -1
  64. package/dist/components/Textarea/index.d.ts +4 -2
  65. package/dist/components/Textarea/index.d.ts.map +1 -1
  66. package/dist/components/Textarea/index.js +55 -15
  67. package/dist/components/Textarea/index.js.map +1 -1
  68. package/dist/constants/theme.d.ts +1 -1
  69. package/dist/containers/ReqoreProvider.d.ts +4 -4
  70. package/dist/helpers/colors.d.ts +2 -2
  71. package/dist/helpers/colors.d.ts.map +1 -1
  72. package/dist/hooks/useCombinedRefs.d.ts +10 -1
  73. package/dist/hooks/useCombinedRefs.d.ts.map +1 -1
  74. package/dist/hooks/useCombinedRefs.js +18 -2
  75. package/dist/hooks/useCombinedRefs.js.map +1 -1
  76. package/dist/hooks/useTheme.d.ts +2 -2
  77. package/dist/hooks/useTheme.d.ts.map +1 -1
  78. package/dist/styles.d.ts +2 -0
  79. package/dist/styles.d.ts.map +1 -1
  80. package/dist/styles.js +5 -3
  81. package/dist/styles.js.map +1 -1
  82. package/dist/types/global.d.ts +83 -0
  83. package/dist/types/global.d.ts.map +1 -1
  84. package/package.json +1 -1
  85. package/src/components/Breadcrumbs/index.tsx +2 -2
  86. package/src/components/Breadcrumbs/item.tsx +4 -5
  87. package/src/components/Button/index.tsx +77 -49
  88. package/src/components/Checkbox/index.tsx +27 -17
  89. package/src/components/Comment/index.tsx +2 -2
  90. package/src/components/ControlGroup/index.tsx +3 -3
  91. package/src/components/Header/index.tsx +2 -2
  92. package/src/components/Icon/index.tsx +2 -2
  93. package/src/components/Input/index.tsx +58 -44
  94. package/src/components/Menu/index.tsx +14 -3
  95. package/src/components/Menu/item.tsx +42 -132
  96. package/src/components/Message/index.tsx +2 -2
  97. package/src/components/Navbar/item.tsx +20 -3
  98. package/src/components/Notifications/notification.tsx +4 -4
  99. package/src/components/Panel/index.tsx +3 -3
  100. package/src/components/Paragraph/index.tsx +2 -2
  101. package/src/components/Sidebar/index.tsx +11 -0
  102. package/src/components/Table/index.tsx +23 -15
  103. package/src/components/Table/row.tsx +11 -11
  104. package/src/components/Tabs/index.tsx +5 -5
  105. package/src/components/Tabs/item.tsx +3 -4
  106. package/src/components/Tag/index.tsx +18 -21
  107. package/src/components/Textarea/index.tsx +76 -28
  108. package/src/constants/theme.ts +1 -1
  109. package/src/containers/ReqoreProvider.tsx +4 -4
  110. package/src/helpers/colors.ts +2 -2
  111. package/src/hooks/useCombinedRefs.ts +9 -2
  112. package/src/hooks/useTheme.ts +2 -2
  113. package/src/mock/data.json +11000 -0
  114. package/src/mock/tableData.ts +5 -14
  115. package/src/stories/Button/Button.stories.tsx +4 -1
  116. package/src/stories/Checkbox/Checkbox.stories.tsx +5 -4
  117. package/src/stories/Input/Input.stories.tsx +39 -6
  118. package/src/stories/Menu/Menu.stories.tsx +14 -2
  119. package/src/stories/RadioGroup/RadioGroup.stories.tsx +10 -0
  120. package/src/stories/Table/Table.stories.tsx +12 -1
  121. package/src/stories/Tag/Tag.stories.tsx +7 -1
  122. package/src/stories/TextArea/TextArea.stories.tsx +83 -13
  123. package/src/styles.ts +11 -2
  124. package/src/types/global.ts +89 -0
  125. package/tests.json +1 -1
@@ -1,4 +1,4 @@
1
- import { forwardRef, useRef } from 'react';
1
+ import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { IReqoreTabsListItem } from '.';
4
4
  import { TABS_PADDING_TO_PX, TSizes } from '../../constants/sizes';
@@ -87,15 +87,14 @@ const ReqoreTabsListItem = forwardRef(
87
87
  }: IReqoreTabListItemProps,
88
88
  ref
89
89
  ) => {
90
- const innerRef = useRef(null);
91
- const combinedRef = useCombinedRefs(innerRef, ref);
90
+ const { targetRef } = useCombinedRefs(ref);
92
91
  const theme = useReqoreTheme('main', customTheme);
93
92
  const _intent = activeIntent || intent;
94
93
  const activeColor = _intent ? theme.intents[_intent] : theme.main;
95
94
 
96
95
  return (
97
96
  <StyledTabListItem
98
- ref={combinedRef}
97
+ ref={targetRef}
99
98
  {...props}
100
99
  className={className}
101
100
  intent={intent}
@@ -1,5 +1,5 @@
1
1
  import _size from 'lodash/size';
2
- import React, { forwardRef, useContext, useRef } from 'react';
2
+ import React, { forwardRef, useContext } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { ReqorePopover } from '../..';
5
5
  import {
@@ -9,24 +9,24 @@ import {
9
9
  TEXT_FROM_SIZE,
10
10
  TSizes,
11
11
  } from '../../constants/sizes';
12
- import { IReqoreIntent, IReqoreTheme } from '../../constants/theme';
12
+ import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
13
13
  import ThemeContext from '../../context/ThemeContext';
14
14
  import { changeLightness, getReadableColor, getReadableColorFrom } from '../../helpers/colors';
15
15
  import { useCombinedRefs } from '../../hooks/useCombinedRefs';
16
- import usePopover from '../../hooks/usePopover';
17
- import { IReqoreTooltip } from '../../types/global';
16
+ import { useTooltip } from '../../hooks/useTooltip';
17
+ import { IReqoreDisabled, IReqoreIntent, IWithReqoreTooltip } from '../../types/global';
18
18
  import { IReqoreIconName } from '../../types/icons';
19
19
  import ReqoreIcon from '../Icon';
20
20
 
21
- export interface IReqoreTagAction {
21
+ export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
22
22
  icon: IReqoreIconName;
23
23
  onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
24
- disabled?: boolean;
25
- tooltip?: IReqoreTooltip;
26
- intent?: IReqoreIntent;
27
24
  }
28
25
 
29
- export interface IReqoreTagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
26
+ export interface IReqoreTagProps
27
+ extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'>,
28
+ IWithReqoreTooltip,
29
+ IReqoreDisabled {
30
30
  size?: TSizes;
31
31
  label?: string;
32
32
  onRemoveClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
@@ -34,12 +34,10 @@ export interface IReqoreTagProps extends Omit<React.HTMLAttributes<HTMLSpanEleme
34
34
  icon?: IReqoreIconName;
35
35
  rightIcon?: IReqoreIconName;
36
36
  color?: string;
37
- tooltip?: IReqoreTooltip;
38
- disabled?: boolean;
39
37
  actions?: IReqoreTagAction[];
40
38
  width?: string;
41
39
  badge?: boolean;
42
- intent?: IReqoreIntent;
40
+ intent?: TReqoreIntent;
43
41
  }
44
42
 
45
43
  export interface IReqoreTagStyle extends IReqoreTagProps {
@@ -154,15 +152,10 @@ const ReqoreTag = forwardRef(
154
152
  }: IReqoreTagProps,
155
153
  ref
156
154
  ) => {
157
- const innerRef = useRef(null);
158
- const combinedRef = useCombinedRefs(innerRef, ref);
155
+ const { targetRef } = useCombinedRefs(ref);
159
156
  const theme: IReqoreTheme = useContext<IReqoreTheme>(ThemeContext);
160
157
 
161
- usePopover({
162
- ...tooltip,
163
- targetElement: combinedRef.current,
164
- show: !!tooltip?.content,
165
- });
158
+ useTooltip(targetRef.current, tooltip);
166
159
 
167
160
  // If color or intent was specified, set the color
168
161
  const customColor = intent ? theme.intents[intent] : color;
@@ -173,7 +166,7 @@ const ReqoreTag = forwardRef(
173
166
  color={customColor}
174
167
  className={`${className || ''} reqore-tag`}
175
168
  size={size}
176
- ref={combinedRef}
169
+ ref={targetRef}
177
170
  badge={badge}
178
171
  removable={!!onRemoveClick}
179
172
  interactive={!!onClick && !rest.disabled}
@@ -199,7 +192,6 @@ const ReqoreTag = forwardRef(
199
192
  ? actions.map((action) => (
200
193
  <>
201
194
  <ReqorePopover
202
- {...action.tooltip}
203
195
  component={StyledButtonWrapper}
204
196
  componentProps={{
205
197
  size,
@@ -207,6 +199,11 @@ const ReqoreTag = forwardRef(
207
199
  className: 'reqore-tag-action',
208
200
  onClick: action.onClick,
209
201
  }}
202
+ {...(action.tooltip
203
+ ? typeof action.tooltip === 'string'
204
+ ? { tooltip: action.tooltip }
205
+ : action.tooltip || {}
206
+ : {})}
210
207
  noWrapper
211
208
  >
212
209
  <ReqoreIcon icon={action.icon} size={`${TEXT_FROM_SIZE[size]}px`} />
@@ -1,14 +1,31 @@
1
- import { darken, rgba } from 'polished';
1
+ import { rgba } from 'polished';
2
2
  import React, { forwardRef } from 'react';
3
- import styled from 'styled-components';
4
- import { TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
3
+ import styled, { css } from 'styled-components';
4
+ import { RADIUS_FROM_SIZE, TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
5
5
  import { IReqoreTheme } from '../../constants/theme';
6
- import { getReadableColor } from '../../helpers/colors';
6
+ import { changeLightness, getReadableColor } from '../../helpers/colors';
7
+ import { useCombinedRefs } from '../../hooks/useCombinedRefs';
8
+ import { useReqoreTheme } from '../../hooks/useTheme';
9
+ import { useTooltip } from '../../hooks/useTooltip';
10
+ import { DisabledElement, ReadOnlyElement } from '../../styles';
11
+ import {
12
+ IReqoreDisabled,
13
+ IReqoreIntent,
14
+ IReqoreReadOnly,
15
+ IWithReqoreCustomTheme,
16
+ IWithReqoreTooltip,
17
+ } from '../../types/global';
18
+ import { IReqoreInputStyle } from '../Input';
7
19
  import ReqoreInputClearButton from '../InputClearButton';
8
20
 
9
- export interface IReqoreTextareaProps extends React.HTMLAttributes<HTMLTextAreaElement> {
21
+ export interface IReqoreTextareaProps
22
+ extends React.HTMLAttributes<HTMLTextAreaElement>,
23
+ IReqoreReadOnly,
24
+ IReqoreDisabled,
25
+ IWithReqoreCustomTheme,
26
+ IWithReqoreTooltip,
27
+ IReqoreIntent {
10
28
  autoFocus?: boolean;
11
- disabled?: boolean;
12
29
  width?: number;
13
30
  height?: number;
14
31
  scaleWithContent?: boolean;
@@ -18,6 +35,8 @@ export interface IReqoreTextareaProps extends React.HTMLAttributes<HTMLTextAreaE
18
35
  value?: string;
19
36
  rows?: number;
20
37
  cols?: number;
38
+ rounded?: boolean;
39
+ flat?: boolean;
21
40
  onClearClick?: () => any;
22
41
  }
23
42
 
@@ -42,25 +61,39 @@ export const StyledTextarea = styled.textarea<IReqoreTextareaStyle>`
42
61
  padding: 5px 7px;
43
62
  resize: none;
44
63
 
45
- background-color: ${({ theme, minimal }: IReqoreTextareaStyle) =>
46
- minimal ? 'transparent' : darken(0.01, theme.main)};
47
- color: ${({ theme }: IReqoreTextareaStyle) => getReadableColor(theme)};
64
+ background-color: ${({ theme, minimal }: IReqoreInputStyle) =>
65
+ minimal ? 'transparent' : rgba(theme.main, 0.3)};
66
+ color: ${({ theme }: IReqoreInputStyle) => getReadableColor(theme)};
48
67
 
49
- border: ${({ minimal, theme }) =>
50
- !minimal ? `1px solid ${rgba(getReadableColor(theme), 0.2)}` : 0};
51
- border-bottom: ${({ minimal, theme }) =>
52
- minimal ? `0.5px solid ${rgba(getReadableColor(theme), 0.2)}` : undefined};
53
-
54
- border-radius: ${({ minimal }) => (minimal ? 0 : 3)}px;
55
68
  transition: all 0.2s ease-out;
56
69
 
57
70
  &:active,
58
- &:focus,
59
- &:hover {
60
- outline: none;
61
- border-color: ${({ theme }) => rgba(getReadableColor(theme), 0.3)};
71
+ &:focus {
72
+ background-color: ${({ theme, minimal }: IReqoreInputStyle) =>
73
+ minimal ? 'transparent' : rgba(theme.main, 0.5)};
62
74
  }
63
75
 
76
+ border-radius: ${({ minimal, rounded, _size }) =>
77
+ minimal || !rounded ? 0 : RADIUS_FROM_SIZE[_size]}px;
78
+ border: ${({ minimal, theme, flat }) =>
79
+ !minimal && !flat ? `1px solid ${changeLightness(theme.main, 0.05)}` : 0};
80
+ border-bottom: ${({ minimal, theme, flat }) =>
81
+ minimal && !flat ? `0.5px solid ${changeLightness(theme.main, 0.05)}` : undefined};
82
+
83
+ transition: all 0.2s ease-out;
84
+
85
+ ${({ disabled, readOnly }) =>
86
+ !disabled && !readOnly
87
+ ? css`
88
+ &:active,
89
+ &:focus,
90
+ &:hover {
91
+ outline: none;
92
+ border-color: ${({ theme }) => changeLightness(theme.main, 0.1)};
93
+ }
94
+ `
95
+ : undefined}
96
+
64
97
  &::placeholder {
65
98
  transition: all 0.2s ease-out;
66
99
  color: ${({ theme }) => rgba(getReadableColor(theme), 0.3)};
@@ -72,9 +105,10 @@ export const StyledTextarea = styled.textarea<IReqoreTextareaStyle>`
72
105
  }
73
106
  }
74
107
 
108
+ ${({ readOnly }) => readOnly && ReadOnlyElement};
109
+
75
110
  &:disabled {
76
- pointer-events: none;
77
- opacity: 0.3;
111
+ ${DisabledElement};
78
112
  }
79
113
  `;
80
114
 
@@ -88,10 +122,19 @@ const ReqoreInput = forwardRef(
88
122
  className,
89
123
  onClearClick,
90
124
  fluid,
125
+ tooltip,
126
+ customTheme,
127
+ intent,
128
+ rounded = true,
91
129
  ...rest
92
130
  }: IReqoreTextareaProps,
93
131
  ref: any
94
132
  ) => {
133
+ const { targetRef } = useCombinedRefs(ref);
134
+ const theme = useReqoreTheme('main', customTheme, intent);
135
+
136
+ useTooltip(targetRef?.current, tooltip);
137
+
95
138
  return (
96
139
  <StyledTextareaWrapper
97
140
  className={`${className || ''} reqore-control-wrapper`}
@@ -99,20 +142,25 @@ const ReqoreInput = forwardRef(
99
142
  height={height}
100
143
  fluid={fluid}
101
144
  _size={size}
145
+ theme={theme}
102
146
  >
103
147
  <StyledTextarea
104
148
  {...rest}
105
149
  className={`${className || ''} reqore-control reqore-textarea`}
106
150
  _size={size}
107
- ref={ref}
151
+ ref={targetRef}
152
+ theme={theme}
153
+ rounded={rounded}
108
154
  rows={scaleWithContent ? (rest?.value?.split(/\r\n|\r|\n/).length || 1) + 1 : rest.rows}
109
155
  />
110
- <ReqoreInputClearButton
111
- enabled={!rest?.disabled && !!(onClearClick && rest?.onChange)}
112
- show={rest?.value && rest.value !== ''}
113
- onClick={onClearClick}
114
- size='big'
115
- />
156
+ {!rest.readOnly && (
157
+ <ReqoreInputClearButton
158
+ enabled={!rest?.disabled && !!(onClearClick && rest?.onChange)}
159
+ show={rest?.value && rest.value !== ''}
160
+ onClick={onClearClick}
161
+ size='big'
162
+ />
163
+ )}
116
164
  </StyledTextareaWrapper>
117
165
  );
118
166
  }
@@ -81,7 +81,7 @@ export interface IReqoreIntents {
81
81
  muted?: string;
82
82
  }
83
83
 
84
- export type IReqoreIntent = 'info' | 'success' | 'pending' | 'warning' | 'danger' | 'muted';
84
+ export type TReqoreIntent = 'info' | 'success' | 'pending' | 'warning' | 'danger' | 'muted';
85
85
 
86
86
  export const DEFAULT_INTENTS: IReqoreIntents = {
87
87
  info: '#0E5A8A',
@@ -10,7 +10,7 @@ import ReqoreNotification, {
10
10
  IReqoreNotificationType,
11
11
  } from '../components/Notifications/notification';
12
12
  import { TSizes } from '../constants/sizes';
13
- import { IReqoreIntent } from '../constants/theme';
13
+ import { TReqoreIntent } from '../constants/theme';
14
14
  import ReqoreContext from '../context/ReqoreContext';
15
15
  import { IReqoreIconName } from '../types/icons';
16
16
 
@@ -24,7 +24,7 @@ export interface IReqoreNotificationData {
24
24
  onFinish?: (id?: string) => any;
25
25
  id?: string;
26
26
  type?: IReqoreNotificationType;
27
- intent?: IReqoreIntent;
27
+ intent?: TReqoreIntent;
28
28
  flat?: boolean;
29
29
  inverted?: boolean;
30
30
  size?: TSizes;
@@ -40,12 +40,12 @@ export interface IReqoreConfirmationModal {
40
40
  description?: string;
41
41
  onConfirm?: () => void;
42
42
  onCancel?: () => void;
43
- confirmButtonIntent?: IReqoreIntent;
43
+ confirmButtonIntent?: TReqoreIntent;
44
44
  confirmLabel?: string;
45
45
  confirmIcon?: IReqoreIconName;
46
46
  cancelLabel?: string;
47
47
  isOpen?: boolean;
48
- intent?: IReqoreIntent;
48
+ intent?: TReqoreIntent;
49
49
  }
50
50
 
51
51
  const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, position }) => {
@@ -1,7 +1,7 @@
1
1
  import { cloneDeep, merge } from 'lodash';
2
2
  import { darken, lighten, readableColor } from 'polished';
3
3
  import { Colors } from '../constants/colors';
4
- import { DEFAULT_INTENTS, IReqoreIntent, IReqoreTheme } from '../constants/theme';
4
+ import { DEFAULT_INTENTS, IReqoreTheme, TReqoreIntent } from '../constants/theme';
5
5
 
6
6
  export const getReadableColor: (
7
7
  theme: Partial<IReqoreTheme>,
@@ -130,7 +130,7 @@ export const mergeThemes = (element: string, theme: IReqoreTheme, customTheme: a
130
130
  return clonedTheme;
131
131
  };
132
132
 
133
- export const getNotificationIntent = (theme: IReqoreTheme, intent?: IReqoreIntent) => {
133
+ export const getNotificationIntent = (theme: IReqoreTheme, intent?: TReqoreIntent) => {
134
134
  if (intent) {
135
135
  return theme.notifications[intent];
136
136
  }
@@ -1,10 +1,17 @@
1
1
  import React from 'react';
2
2
 
3
+ /**
4
+ * It takes a list of refs and returns a single ref that can be used to reference the same underlying
5
+ * DOM element
6
+ * @param refs - An array of refs to combine.
7
+ * @returns A ref object.
8
+ */
3
9
  export function useCombinedRefs(...refs) {
10
+ const [_innerRef, setInnerRef] = React.useState(null);
4
11
  const targetRef = React.useRef();
5
12
 
6
13
  React.useEffect(() => {
7
- refs.forEach((ref) => {
14
+ [...refs, setInnerRef].forEach((ref) => {
8
15
  if (!ref) return;
9
16
 
10
17
  if (typeof ref === 'function') {
@@ -15,5 +22,5 @@ export function useCombinedRefs(...refs) {
15
22
  });
16
23
  }, [refs]);
17
24
 
18
- return targetRef;
25
+ return { _innerRef, targetRef };
19
26
  }
@@ -1,13 +1,13 @@
1
1
  import { cloneDeep } from 'lodash';
2
2
  import { useContext } from 'react';
3
- import { IReqoreIntent, IReqoreTheme } from '../constants/theme';
3
+ import { IReqoreTheme, TReqoreIntent } from '../constants/theme';
4
4
  import ThemeContext from '../context/ThemeContext';
5
5
  import { mergeThemes } from '../helpers/colors';
6
6
 
7
7
  export const useReqoreTheme = (
8
8
  element: string,
9
9
  customTheme: Partial<IReqoreTheme> = {},
10
- intent?: IReqoreIntent
10
+ intent?: TReqoreIntent
11
11
  ) => {
12
12
  const theme: IReqoreTheme = useContext<IReqoreTheme>(ThemeContext);
13
13
  let _customTheme: Partial<IReqoreTheme> = cloneDeep(customTheme);