@qoretechnologies/reqore 0.30.6 → 0.30.7

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