@qoretechnologies/reqore 0.28.6 → 0.29.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 (167) hide show
  1. package/.vscode/settings.json +2 -1
  2. package/__tests__/checkbox.test.tsx +7 -12
  3. package/__tests__/multiselect.test.tsx +407 -0
  4. package/__tests__/popover.test.tsx +35 -8
  5. package/dist/components/Button/index.js +1 -1
  6. package/dist/components/Button/index.js.map +1 -1
  7. package/dist/components/Checkbox/index.d.ts +7 -2
  8. package/dist/components/Checkbox/index.d.ts.map +1 -1
  9. package/dist/components/Checkbox/index.js +60 -26
  10. package/dist/components/Checkbox/index.js.map +1 -1
  11. package/dist/components/Collection/item.js +2 -2
  12. package/dist/components/Collection/item.js.map +1 -1
  13. package/dist/components/ControlGroup/index.d.ts +3 -4
  14. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  15. package/dist/components/ControlGroup/index.js +7 -9
  16. package/dist/components/ControlGroup/index.js.map +1 -1
  17. package/dist/components/Dropdown/index.d.ts +2 -1
  18. package/dist/components/Dropdown/index.d.ts.map +1 -1
  19. package/dist/components/Dropdown/index.js +3 -3
  20. package/dist/components/Dropdown/index.js.map +1 -1
  21. package/dist/components/Dropdown/list.d.ts +6 -3
  22. package/dist/components/Dropdown/list.d.ts.map +1 -1
  23. package/dist/components/Dropdown/list.js +19 -1
  24. package/dist/components/Dropdown/list.js.map +1 -1
  25. package/dist/components/Effect/index.d.ts +15 -2
  26. package/dist/components/Effect/index.d.ts.map +1 -1
  27. package/dist/components/Effect/index.js +60 -23
  28. package/dist/components/Effect/index.js.map +1 -1
  29. package/dist/components/Icon/index.d.ts +2 -9
  30. package/dist/components/Icon/index.d.ts.map +1 -1
  31. package/dist/components/Icon/index.js +4 -28
  32. package/dist/components/Icon/index.js.map +1 -1
  33. package/dist/components/Input/index.js +3 -3
  34. package/dist/components/Input/index.js.map +1 -1
  35. package/dist/components/InputClearButton/index.d.ts.map +1 -1
  36. package/dist/components/InputClearButton/index.js +1 -1
  37. package/dist/components/InputClearButton/index.js.map +1 -1
  38. package/dist/components/InternalPopover/index.d.ts.map +1 -1
  39. package/dist/components/InternalPopover/index.js +19 -5
  40. package/dist/components/InternalPopover/index.js.map +1 -1
  41. package/dist/components/Menu/divider.d.ts +3 -2
  42. package/dist/components/Menu/divider.d.ts.map +1 -1
  43. package/dist/components/Menu/divider.js +2 -2
  44. package/dist/components/Menu/divider.js.map +1 -1
  45. package/dist/components/Menu/index.js +4 -3
  46. package/dist/components/Menu/index.js.map +1 -1
  47. package/dist/components/MultiSelect/index.d.ts +34 -0
  48. package/dist/components/MultiSelect/index.d.ts.map +1 -0
  49. package/dist/components/MultiSelect/index.js +178 -0
  50. package/dist/components/MultiSelect/index.js.map +1 -0
  51. package/dist/components/Panel/index.d.ts.map +1 -1
  52. package/dist/components/Panel/index.js +1 -1
  53. package/dist/components/Panel/index.js.map +1 -1
  54. package/dist/components/Popover/index.d.ts +1 -1
  55. package/dist/components/Popover/index.d.ts.map +1 -1
  56. package/dist/components/Popover/index.js +5 -2
  57. package/dist/components/Popover/index.js.map +1 -1
  58. package/dist/components/RadioGroup/index.d.ts +3 -1
  59. package/dist/components/RadioGroup/index.d.ts.map +1 -1
  60. package/dist/components/RadioGroup/index.js +2 -2
  61. package/dist/components/RadioGroup/index.js.map +1 -1
  62. package/dist/components/Table/row.js +2 -2
  63. package/dist/components/Table/row.js.map +1 -1
  64. package/dist/components/Tabs/item.js +1 -1
  65. package/dist/components/Tabs/item.js.map +1 -1
  66. package/dist/components/Tabs/list.d.ts.map +1 -1
  67. package/dist/components/Tabs/list.js +5 -4
  68. package/dist/components/Tabs/list.js.map +1 -1
  69. package/dist/components/Tag/group.d.ts +3 -3
  70. package/dist/components/Tag/group.d.ts.map +1 -1
  71. package/dist/components/Tag/group.js +6 -3
  72. package/dist/components/Tag/group.js.map +1 -1
  73. package/dist/components/Tag/index.d.ts +1 -1
  74. package/dist/components/Tag/index.d.ts.map +1 -1
  75. package/dist/components/Tag/index.js +21 -18
  76. package/dist/components/Tag/index.js.map +1 -1
  77. package/dist/components/Textarea/index.js +3 -3
  78. package/dist/components/Textarea/index.js.map +1 -1
  79. package/dist/components/Tree/index.js +1 -1
  80. package/dist/components/Tree/index.js.map +1 -1
  81. package/dist/containers/PopoverProvider.d.ts.map +1 -1
  82. package/dist/containers/PopoverProvider.js +28 -3
  83. package/dist/containers/PopoverProvider.js.map +1 -1
  84. package/dist/containers/ReqoreProvider.d.ts.map +1 -1
  85. package/dist/containers/ReqoreProvider.js +6 -5
  86. package/dist/containers/ReqoreProvider.js.map +1 -1
  87. package/dist/containers/UIProvider.d.ts +1 -0
  88. package/dist/containers/UIProvider.d.ts.map +1 -1
  89. package/dist/containers/UIProvider.js.map +1 -1
  90. package/dist/context/PopoverContext.d.ts +1 -0
  91. package/dist/context/PopoverContext.d.ts.map +1 -1
  92. package/dist/context/PopoverContext.js.map +1 -1
  93. package/dist/context/ReqoreContext.d.ts +1 -0
  94. package/dist/context/ReqoreContext.d.ts.map +1 -1
  95. package/dist/context/ReqoreContext.js +2 -1
  96. package/dist/context/ReqoreContext.js.map +1 -1
  97. package/dist/helpers/colors.d.ts +3 -0
  98. package/dist/helpers/colors.d.ts.map +1 -1
  99. package/dist/helpers/colors.js +27 -3
  100. package/dist/helpers/colors.js.map +1 -1
  101. package/dist/hooks/usePopover.d.ts +8 -1
  102. package/dist/hooks/usePopover.d.ts.map +1 -1
  103. package/dist/hooks/usePopover.js +12 -7
  104. package/dist/hooks/usePopover.js.map +1 -1
  105. package/dist/hooks/useReqore.d.ts +3 -0
  106. package/dist/hooks/useReqore.d.ts.map +1 -0
  107. package/dist/hooks/useReqore.js +17 -0
  108. package/dist/hooks/useReqore.js.map +1 -0
  109. package/dist/hooks/useTheme.d.ts +1 -1
  110. package/dist/hooks/useTheme.d.ts.map +1 -1
  111. package/dist/hooks/useTheme.js +3 -0
  112. package/dist/hooks/useTheme.js.map +1 -1
  113. package/dist/index.d.ts +3 -0
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +8 -2
  116. package/dist/index.js.map +1 -1
  117. package/package.json +1 -1
  118. package/src/components/Button/index.tsx +1 -1
  119. package/src/components/Checkbox/index.tsx +189 -34
  120. package/src/components/Collection/item.tsx +2 -2
  121. package/src/components/ControlGroup/index.tsx +46 -35
  122. package/src/components/Dropdown/index.tsx +5 -0
  123. package/src/components/Dropdown/list.tsx +29 -15
  124. package/src/components/Effect/index.tsx +123 -55
  125. package/src/components/Icon/index.tsx +4 -52
  126. package/src/components/Input/index.tsx +3 -3
  127. package/src/components/InputClearButton/index.tsx +1 -0
  128. package/src/components/InternalPopover/index.tsx +6 -3
  129. package/src/components/Menu/divider.tsx +15 -4
  130. package/src/components/Menu/index.tsx +3 -3
  131. package/src/components/MultiSelect/index.tsx +292 -0
  132. package/src/components/Panel/index.tsx +6 -4
  133. package/src/components/Popover/index.tsx +8 -3
  134. package/src/components/RadioGroup/index.tsx +6 -0
  135. package/src/components/Table/row.tsx +2 -2
  136. package/src/components/Tabs/item.tsx +1 -1
  137. package/src/components/Tabs/list.tsx +11 -11
  138. package/src/components/Tag/group.tsx +10 -2
  139. package/src/components/Tag/index.tsx +26 -20
  140. package/src/components/Textarea/index.tsx +3 -3
  141. package/src/components/Tree/index.tsx +3 -3
  142. package/src/containers/PopoverProvider.tsx +35 -3
  143. package/src/containers/ReqoreProvider.tsx +6 -4
  144. package/src/containers/UIProvider.tsx +1 -0
  145. package/src/context/PopoverContext.tsx +1 -0
  146. package/src/context/ReqoreContext.tsx +2 -0
  147. package/src/helpers/colors.ts +52 -4
  148. package/src/hooks/usePopover.tsx +24 -10
  149. package/src/hooks/useReqore.ts +12 -0
  150. package/src/hooks/useTheme.ts +6 -1
  151. package/src/index.tsx +3 -0
  152. package/src/mock/collectionData.tsx +6 -6
  153. package/src/mock/multiSelect.ts +69 -0
  154. package/src/stories/Button/Button.stories.tsx +20 -8
  155. package/src/stories/Checkbox/Checkbox.stories.tsx +42 -7
  156. package/src/stories/ControlGroup/ControlGroup.stories.tsx +7 -2
  157. package/src/stories/Dropdown/Dropdown.stories.tsx +6 -1
  158. package/src/stories/Icon/Icon.stories.tsx +42 -12
  159. package/src/stories/Input/Input.stories.tsx +25 -0
  160. package/src/stories/Menu/Menu.stories.tsx +3 -1
  161. package/src/stories/MultiSelect/MultiSelect.stories.tsx +106 -0
  162. package/src/stories/Popover/Popover.stories.tsx +19 -2
  163. package/src/stories/RadioGroup/RadioGroup.stories.tsx +51 -1
  164. package/src/stories/Tabs/Tabs.stories.tsx +23 -3
  165. package/src/stories/Tag/Tag.stories.tsx +10 -3
  166. package/src/stories/utils/args.ts +1 -1
  167. package/tests.json +1 -1
@@ -170,7 +170,7 @@ export const ReqoreCollectionItem = ({
170
170
  setIsSelected(!isSelected);
171
171
  }
172
172
 
173
- rest?.onClick?.(event);
173
+ rest.onClick?.(event);
174
174
  };
175
175
 
176
176
  const actualContent: string | React.ReactNode =
@@ -239,5 +239,5 @@ export const ReqoreCollectionItem = ({
239
239
  );
240
240
  };
241
241
 
242
- return isSelected ? renderContent() : renderContent();
242
+ return renderContent();
243
243
  };
@@ -1,12 +1,15 @@
1
- import React from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { GAP_FROM_SIZE, RADIUS_FROM_SIZE, TSizes } from '../../constants/sizes';
4
4
  import { IReqoreTheme } from '../../constants/theme';
5
+ import { IWithReqoreFlat, IWithReqoreMinimal, IWithReqoreSize } from '../../types/global';
5
6
 
6
- export interface IReqoreControlGroupProps extends React.HTMLAttributes<HTMLDivElement> {
7
+ export interface IReqoreControlGroupProps
8
+ extends React.HTMLAttributes<HTMLDivElement>,
9
+ IWithReqoreFlat,
10
+ IWithReqoreSize,
11
+ IWithReqoreMinimal {
7
12
  stack?: boolean;
8
- minimal?: boolean;
9
- size?: TSizes;
10
13
  children: any;
11
14
  fluid?: boolean;
12
15
  rounded?: boolean;
@@ -98,37 +101,45 @@ export const StyledReqoreControlGroup = styled.div<IReqoreControlGroupStyle>`
98
101
  `}
99
102
  `;
100
103
 
101
- const ReqoreControlGroup = ({
102
- children,
103
- className,
104
- minimal,
105
- size = 'normal',
106
- gapSize = 'normal',
107
- fluid,
108
- rounded = true,
109
- ...rest
110
- }: IReqoreControlGroupProps) => (
111
- <StyledReqoreControlGroup
112
- {...rest}
113
- size={size}
114
- gapSize={gapSize}
115
- rounded={rounded}
116
- fluid={fluid}
117
- className={`${className || ''} reqore-control-group`}
118
- >
119
- {React.Children.map(children, (child) =>
120
- child
121
- ? React.cloneElement(child, {
122
- minimal:
123
- child.props?.minimal || child.props?.minimal === false
124
- ? child.props.minimal
125
- : minimal,
126
- size: child.props?.size || size,
127
- fluid,
128
- })
129
- : null
130
- )}
131
- </StyledReqoreControlGroup>
104
+ const ReqoreControlGroup = forwardRef<HTMLDivElement, IReqoreControlGroupProps>(
105
+ (
106
+ {
107
+ children,
108
+ className,
109
+ minimal,
110
+ size = 'normal',
111
+ gapSize = 'normal',
112
+ fluid,
113
+ flat,
114
+ rounded = true,
115
+ ...rest
116
+ }: IReqoreControlGroupProps,
117
+ ref
118
+ ) => (
119
+ <StyledReqoreControlGroup
120
+ {...rest}
121
+ size={size}
122
+ gapSize={gapSize}
123
+ ref={ref}
124
+ rounded={rounded}
125
+ fluid={fluid}
126
+ className={`${className || ''} reqore-control-group`}
127
+ >
128
+ {React.Children.map(children, (child) =>
129
+ child
130
+ ? React.cloneElement(child, {
131
+ minimal:
132
+ child.props?.minimal || child.props?.minimal === false
133
+ ? child.props.minimal
134
+ : minimal,
135
+ size: child.props?.size || size,
136
+ flat: child.props?.flat || child.props?.flat === false ? child.props.flat : flat,
137
+ fluid,
138
+ })
139
+ : null
140
+ )}
141
+ </StyledReqoreControlGroup>
142
+ )
132
143
  );
133
144
 
134
145
  export default ReqoreControlGroup;
@@ -16,6 +16,7 @@ export interface IReqoreDropdownProps extends Partial<IPopoverOptions> {
16
16
  label?: any;
17
17
  children?: any;
18
18
  listWidth?: string;
19
+ listHeight?: string;
19
20
  icon?: IReqoreIconName;
20
21
  rightIcon?: IReqoreIconName;
21
22
  caretPosition?: 'left' | 'right';
@@ -53,6 +54,8 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
53
54
  targetElement,
54
55
  useTargetWidth,
55
56
  listWidth,
57
+ listHeight,
58
+ passPopoverData,
56
59
  ...rest
57
60
  }: IReqoreDropdownProps & T) {
58
61
  const componentProps = useMemo(
@@ -74,6 +77,7 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
74
77
  multiSelect={multiSelect}
75
78
  listStyle={listStyle}
76
79
  width={useTargetWidth ? '100%' : listWidth}
80
+ height={listHeight}
77
81
  items={items}
78
82
  filterable={filterable}
79
83
  onItemSelect={onItemSelect}
@@ -99,6 +103,7 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
99
103
  handler={handler || 'click'}
100
104
  openOnMount={isDefaultOpen}
101
105
  content={popoverContent}
106
+ passPopoverData={passPopoverData}
102
107
  >
103
108
  {children || label}
104
109
  </ReqorePopover>
@@ -2,18 +2,23 @@ import React, { memo, useEffect, useMemo, useState } from 'react';
2
2
  import { IReqoreComponent } from '../../types/global';
3
3
  import ReqoreInput from '../Input';
4
4
  import ReqoreMenu from '../Menu';
5
+ import ReqoreMenuDivider from '../Menu/divider';
5
6
  import ReqoreMenuItem, { IReqoreMenuItemProps } from '../Menu/item';
6
7
 
7
8
  export type TDropdownItemOnClick = (item: IReqoreDropdownItem) => void;
8
9
  export interface IReqoreDropdownItem
9
10
  extends Omit<IReqoreMenuItemProps, 'onClick' | 'rightIcon' | 'onRightIconClick'> {
10
- value: any;
11
- label?: string;
11
+ value?: any;
12
12
  onClick?: TDropdownItemOnClick;
13
+ divider?: boolean;
14
+ dividerAlign?: 'left' | 'center' | 'right';
13
15
  }
14
16
 
17
+ export type TReqoreDropdownItem = IReqoreDropdownItem;
18
+ export type TReqoreDropdownItems = TReqoreDropdownItem[];
19
+
15
20
  export interface IReqoreDropdownListProps extends IReqoreComponent {
16
- items?: IReqoreDropdownItem[];
21
+ items?: TReqoreDropdownItems;
17
22
  multiSelect?: boolean;
18
23
  listStyle?: React.CSSProperties;
19
24
  width?: string;
@@ -33,20 +38,24 @@ const ReqoreDropdownList = memo(
33
38
  height,
34
39
  onItemSelect,
35
40
  }: IReqoreDropdownListProps) => {
36
- const [_items, setItems] = useState<IReqoreDropdownItem[]>(items);
41
+ const [_items, setItems] = useState<TReqoreDropdownItems>(items);
37
42
  const [query, setQuery] = useState<string>('');
38
43
 
39
44
  useEffect(() => {
40
45
  setItems(items);
41
46
  }, [items]);
42
47
 
43
- const filteredItems: IReqoreDropdownItem[] = useMemo(() => {
48
+ const filteredItems: TReqoreDropdownItems = useMemo(() => {
44
49
  if (!filterable || query === '') {
45
50
  return _items;
46
51
  }
47
52
 
48
53
  return _items.filter((item) => {
49
- const text = item.label || item.value || item.children;
54
+ if (item.divider) {
55
+ return false;
56
+ }
57
+
58
+ const text: string | undefined = item.label || item.value || item.children;
50
59
 
51
60
  if (!text) {
52
61
  return false;
@@ -88,15 +97,20 @@ const ReqoreDropdownList = memo(
88
97
  />
89
98
  </>
90
99
  )}
91
- {filteredItems.map((item: IReqoreDropdownItem, index: number) => (
92
- <ReqoreMenuItem
93
- key={index}
94
- {...item}
95
- label={item.label || item.value}
96
- onClick={() => handleItemClick(item)}
97
- rightIcon={item.selected ? 'CheckLine' : undefined}
98
- />
99
- ))}
100
+ {filteredItems.map(
101
+ ({ onClick, dividerAlign, divider, ...item }: IReqoreDropdownItem, index: number) =>
102
+ divider ? (
103
+ <ReqoreMenuDivider key={index} {...item} align={dividerAlign} />
104
+ ) : (
105
+ <ReqoreMenuItem
106
+ key={index}
107
+ {...item}
108
+ label={item.label || item.value}
109
+ onClick={() => handleItemClick({ ...item, onClick })}
110
+ rightIcon={item.selected ? 'CheckLine' : undefined}
111
+ />
112
+ )
113
+ )}
100
114
  </ReqoreMenu>
101
115
  );
102
116
  }
@@ -1,14 +1,16 @@
1
- import { reduce } from 'lodash';
2
- import { mix } from 'polished';
1
+ import { rgba } from 'polished';
3
2
  import { HTMLAttributes } from 'react';
4
3
  import styled, { css } from 'styled-components';
5
4
  import { TEXT_FROM_SIZE, TSizes, WEIGHT_TO_NUMBER } from '../../constants/sizes';
6
5
  import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
7
6
  import {
8
7
  changeLightness,
8
+ createEffectGradient,
9
9
  getColorFromMaybeString,
10
+ getGradientMix,
10
11
  getReadableColorFrom,
11
12
  } from '../../helpers/colors';
13
+ import { IWithReqoreMinimal } from '../../types/global';
12
14
 
13
15
  export type TReqoreEffectColorManipulation = 'darken' | 'lighten';
14
16
  export type TReqoreEffectColorManipulationMultiplier = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
@@ -28,7 +30,18 @@ export type TReqoreEffectColorList = [
28
30
  TReqoreEffectColorManipulationMultiplier | undefined
29
31
  ];
30
32
 
31
- export interface IReqoreEffect {
33
+ export interface IReqoreEffectFilters {
34
+ grayscale?: boolean;
35
+ blur?: number;
36
+ sepia?: boolean;
37
+ invert?: boolean;
38
+ opacity?: number;
39
+ brightness?: number;
40
+ contrast?: number;
41
+ saturate?: number;
42
+ }
43
+
44
+ export interface IReqoreEffect extends IReqoreEffectFilters {
32
45
  gradient?: {
33
46
  type?: 'linear' | 'radial';
34
47
  shape?: 'circle' | 'ellipse';
@@ -53,83 +66,92 @@ export interface IReqoreEffect {
53
66
  interactive?: boolean;
54
67
  }
55
68
 
56
- export interface IReqoreTextEffectProps extends HTMLAttributes<HTMLSpanElement> {
69
+ export interface IReqoreTextEffectProps
70
+ extends HTMLAttributes<HTMLSpanElement>,
71
+ IWithReqoreMinimal {
57
72
  children: React.ReactNode;
58
73
  effect: IReqoreEffect;
59
74
  as?: React.ElementType;
60
75
  theme?: IReqoreTheme;
76
+ active?: boolean;
77
+ isText?: boolean;
61
78
  }
62
79
 
63
80
  export const StyledEffect = styled.span`
64
81
  transition: all 0.2s ease-in-out;
65
82
 
66
83
  // If gradient was supplied
67
- ${({ effect, theme }: IReqoreTextEffectProps) => {
84
+ ${({ effect, theme, minimal, active, isText }: IReqoreTextEffectProps) => {
68
85
  if (!effect || !effect.gradient) {
69
86
  return undefined;
70
87
  }
71
88
 
72
89
  const gradientType: string = effect.gradient.type || 'linear';
73
- const gradientColors = reduce(
74
- effect.gradient.colors,
75
- (colorsString, color, percentage) =>
76
- `${colorsString}, ${
77
- color === 'transparent' || !effect.interactive
78
- ? getColorFromMaybeString(theme, color)
79
- : changeLightness(getColorFromMaybeString(theme, color), 0.03)
80
- } ${percentage}%`,
81
- ''
82
- );
83
- const gradientColorsActive = reduce(
90
+ const gradientColors = createEffectGradient(
91
+ theme,
84
92
  effect.gradient.colors,
85
- (colorsString, color, percentage) =>
86
- `${colorsString}, ${getColorFromMaybeString(theme, color)} ${percentage}%`,
87
- ''
93
+ 0,
94
+ !isText && minimal && !active
88
95
  );
96
+ const gradientColorsActive = createEffectGradient(theme, effect.gradient.colors, 0.05);
89
97
 
90
98
  const gradientDirectionOrShape =
91
99
  gradientType === 'linear'
92
100
  ? effect.gradient.direction || 'to right'
93
101
  : effect.gradient.shape || 'circle';
94
- const gradient = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColors})`;
95
- const gradientActive = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColorsActive})`;
102
+ let gradient = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColors}) padding-box`;
103
+ let gradientActive = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColorsActive}) padding-box`;
96
104
 
97
105
  // Determine the text color based on the gradient colors
98
106
  let color: TReqoreHexColor | undefined;
99
107
  // Only works if there are 2 colors not more and color was not provided
100
108
  if (!effect.color) {
101
- if (Object.keys(effect.gradient.colors).length === 2) {
102
- const gradientColor1: TReqoreHexColor = getColorFromMaybeString(
103
- theme,
104
- Object.values(effect.gradient.colors)[0]
105
- );
106
- const gradientColor2: TReqoreHexColor = getColorFromMaybeString(
107
- theme,
108
- Object.values(effect.gradient.colors)[1]
109
- );
110
-
111
- color = mix(
112
- 0.5,
113
- gradientColor1 === '#00000000' ? theme.main : gradientColor1,
114
- gradientColor2 === '#00000000' ? theme.main : gradientColor2
115
- ) as TReqoreHexColor;
116
- }
109
+ color = getGradientMix(theme, effect.gradient.colors);
110
+ }
111
+
112
+ let borderColor: string;
113
+ let borderHoverColor: string;
114
+
115
+ // The user provided a border color - we will use that
116
+ if (effect.gradient.borderColor) {
117
+ borderColor = `${getColorFromMaybeString(theme, effect.gradient.borderColor)}`;
118
+ borderHoverColor = `${changeLightness(
119
+ getColorFromMaybeString(theme, effect.gradient.borderColor),
120
+ 0.15
121
+ )}`;
122
+ } else if (!isText) {
123
+ // We will use border-image and create a gradient border
124
+ borderColor = 'transparent';
125
+ borderHoverColor = 'transparent';
126
+
127
+ const borderGradientColors: string = createEffectGradient(
128
+ theme,
129
+ effect.gradient.colors,
130
+ 0.15
131
+ );
132
+ const borderGradientColorsActive: string = createEffectGradient(
133
+ theme,
134
+ effect.gradient.colors,
135
+ 0.25
136
+ );
137
+
138
+ gradient = `${gradient}, ${gradientType}-gradient(${gradientDirectionOrShape}${borderGradientColors}) border-box`;
139
+ gradientActive = `${gradientActive}, ${gradientType}-gradient(${gradientDirectionOrShape}${borderGradientColorsActive}) border-box`;
117
140
  }
118
141
 
119
142
  return css`
120
- background-image: ${gradient};
121
- // Get the first color from the colors object
122
- border-color: ${changeLightness(
123
- getColorFromMaybeString(
124
- theme,
125
- effect.gradient.borderColor || Object.values(effect.gradient.colors)[0]
126
- ),
127
- 0.04
128
- )} !important;
143
+ background: ${active ? gradientActive : gradient};
144
+ border-color: ${borderColor} !important;
129
145
 
130
146
  ${color &&
131
147
  css`
132
148
  color: ${getReadableColorFrom(getColorFromMaybeString(theme, color), false)} !important;
149
+ &::placeholder {
150
+ color: ${rgba(
151
+ getReadableColorFrom(getColorFromMaybeString(theme, color), false),
152
+ 0.7
153
+ )} !important;
154
+ }
133
155
  `}
134
156
 
135
157
  ${effect.interactive &&
@@ -139,11 +161,8 @@ export const StyledEffect = styled.span`
139
161
  &:hover,
140
162
  &:focus,
141
163
  &:active {
142
- background-image: ${gradientActive};
143
- border-color: ${getColorFromMaybeString(
144
- theme,
145
- effect.gradient.borderColor || Object.values(effect.gradient.colors)[0]
146
- )} !important;
164
+ background: ${gradientActive};
165
+ border-color: ${borderHoverColor} !important;
147
166
  }
148
167
  `}
149
168
  `;
@@ -162,7 +181,7 @@ export const StyledEffect = styled.span`
162
181
  }
163
182
 
164
183
  return css`
165
- box-shadow: ${effect.glow.inset ? 'inset ' : ''} 0 0 ${effect.glow.blur || 0}
184
+ box-shadow: ${effect.glow.inset ? 'inset ' : ''} 0 0 ${effect.glow.blur || 0}px
166
185
  ${effect.glow.size || 2}px ${getColorFromMaybeString(theme, effect.glow.color)};
167
186
  `;
168
187
  }}
@@ -224,16 +243,65 @@ export const StyledEffect = styled.span`
224
243
  text-align: ${effect.textAlign};
225
244
  `
226
245
  : undefined}
246
+
247
+ ${({ effect }) =>
248
+ effect &&
249
+ effect.grayscale &&
250
+ css`
251
+ filter: grayscale(100%);
252
+ `};
253
+ ${({ effect }) =>
254
+ effect &&
255
+ effect.blur &&
256
+ css`
257
+ filter: blur(${effect.blur}px);
258
+ `};
259
+ ${({ effect }) =>
260
+ effect &&
261
+ effect.sepia &&
262
+ css`
263
+ filter: sepia(100%);
264
+ `};
265
+ ${({ effect }) =>
266
+ effect &&
267
+ effect.invert &&
268
+ css`
269
+ filter: invert(100%);
270
+ `};
271
+ ${({ effect }) =>
272
+ effect && (effect.opacity || effect.opacity === 0)
273
+ ? css`
274
+ opacity: ${effect.opacity};
275
+ `
276
+ : undefined};
277
+ ${({ effect }) =>
278
+ effect &&
279
+ effect.brightness &&
280
+ css`
281
+ filter: brightness(${effect.brightness}%);
282
+ `};
283
+ ${({ effect }) =>
284
+ effect &&
285
+ effect.contrast &&
286
+ css`
287
+ filter: contrast(${effect.contrast}%);
288
+ `};
289
+ ${({ effect }) =>
290
+ effect &&
291
+ effect.saturate &&
292
+ css`
293
+ filter: saturate(${effect.saturate}%);
294
+ `};
227
295
  `;
228
296
 
229
- export const StyledTextEffect = styled(StyledEffect)`
297
+ export const StyledTextEffect = styled(StyledEffect).attrs((props) => ({ ...props, isText: true }))`
230
298
  display: inline-block;
231
299
 
232
300
  ${({ effect }: IReqoreTextEffectProps) =>
233
301
  effect && effect.gradient
234
302
  ? css`
235
- -webkit-background-clip: text;
236
- -webkit-text-fill-color: transparent;
303
+ -webkit-background-clip: text !important;
304
+ -webkit-text-fill-color: transparent !important;
237
305
  `
238
306
  : undefined}
239
307
  `;
@@ -7,9 +7,11 @@ import { ReqoreThemeContext } from '../..';
7
7
  import { ICON_FROM_SIZE, PADDING_FROM_SIZE, TSizes } from '../../constants/sizes';
8
8
  import { TReqoreIntent } from '../../constants/theme';
9
9
  import { isStringSize } from '../../helpers/utils';
10
+ import { IWithReqoreEffect } from '../../types/global';
10
11
  import { IReqoreIconName } from '../../types/icons';
12
+ import { StyledEffect } from '../Effect';
11
13
 
12
- export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement> {
14
+ export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement>, IWithReqoreEffect {
13
15
  icon?: IReqoreIconName;
14
16
  color?: string;
15
17
  size?: TSizes | string;
@@ -18,17 +20,9 @@ export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement>
18
20
  margin?: 'right' | 'left' | 'both';
19
21
  image?: string;
20
22
  rounded?: boolean;
21
- grayscale?: boolean;
22
- blur?: number;
23
- sepia?: boolean;
24
- invert?: boolean;
25
- opacity?: number;
26
- brightness?: number;
27
- contrast?: number;
28
- saturate?: number;
29
23
  }
30
24
 
31
- export const StyledIconWrapper = styled.span<{ margin: 'right' | 'left' | 'both' }>`
25
+ export const StyledIconWrapper = styled(StyledEffect)<{ margin: 'right' | 'left' | 'both' }>`
32
26
  display: inline-block;
33
27
  flex: 0 0 auto;
34
28
  vertical-align: text-bottom;
@@ -37,48 +31,6 @@ export const StyledIconWrapper = styled.span<{ margin: 'right' | 'left' | 'both'
37
31
 
38
32
  border-radius: ${({ rounded }) => (rounded ? '50%' : undefined)};
39
33
 
40
- ${({ grayscale }) =>
41
- grayscale &&
42
- css`
43
- filter: grayscale(100%);
44
- `};
45
- ${({ blur }) =>
46
- blur &&
47
- css`
48
- filter: blur(${blur}px);
49
- `};
50
- ${({ sepia }) =>
51
- sepia &&
52
- css`
53
- filter: sepia(100%);
54
- `};
55
- ${({ invert }) =>
56
- invert &&
57
- css`
58
- filter: invert(100%);
59
- `};
60
- ${({ opacity }) =>
61
- opacity || opacity === 0
62
- ? css`
63
- opacity: ${opacity};
64
- `
65
- : undefined};
66
- ${({ brightness }) =>
67
- brightness &&
68
- css`
69
- filter: brightness(${brightness}%);
70
- `};
71
- ${({ contrast }) =>
72
- contrast &&
73
- css`
74
- filter: contrast(${contrast}%);
75
- `};
76
- ${({ saturate }) =>
77
- saturate &&
78
- css`
79
- filter: saturate(${saturate}%);
80
- `};
81
-
82
34
  ${({ margin, size }) =>
83
35
  margin &&
84
36
  css`
@@ -90,9 +90,9 @@ export const StyledInput = styled(StyledEffect)<IReqoreInputStyle>`
90
90
  border-radius: ${({ minimal, rounded, _size }) =>
91
91
  minimal || !rounded ? 0 : RADIUS_FROM_SIZE[_size]}px;
92
92
  border: ${({ minimal, theme, flat }) =>
93
- !minimal && !flat ? `1px solid ${changeLightness(theme.main, 0.05)}` : 0};
93
+ !minimal && !flat ? `1px solid ${changeLightness(theme.main, 0.2)}` : 0};
94
94
  border-bottom: ${({ minimal, theme, flat }) =>
95
- minimal && !flat ? `0.5px solid ${changeLightness(theme.main, 0.05)}` : undefined};
95
+ minimal && !flat ? `0.5px solid ${changeLightness(theme.main, 0.2)}` : undefined};
96
96
 
97
97
  ${({ disabled, readOnly }) =>
98
98
  !disabled && !readOnly
@@ -101,7 +101,7 @@ export const StyledInput = styled(StyledEffect)<IReqoreInputStyle>`
101
101
  &:focus,
102
102
  &:hover {
103
103
  outline: none;
104
- border-color: ${({ theme }) => changeLightness(theme.main, 0.1)};
104
+ border-color: ${({ theme }) => changeLightness(theme.main, 0.25)};
105
105
  }
106
106
  `
107
107
  : undefined}
@@ -25,6 +25,7 @@ const ReqoreInputClearButton = ({
25
25
  className='reqore-clear-input-button'
26
26
  icon='CloseLine'
27
27
  minimal
28
+ flat
28
29
  tabIndex={show ? 1 : -1}
29
30
  size={size}
30
31
  show={show}
@@ -62,6 +62,8 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
62
62
  max-height: ${({ maxHeight = '80vh' }) => maxHeight};
63
63
  z-index: 999999;
64
64
  border-radius: ${RADIUS_FROM_SIZE.normal}px;
65
+ border: ${({ flat, isString, ...rest }: any) =>
66
+ !flat && !isString ? `1px solid ${getPopoverArrowColor({ ...rest, flat })}` : undefined};
65
67
 
66
68
  ${({ transparent }) =>
67
69
  !transparent &&
@@ -165,7 +167,7 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
165
167
  {
166
168
  name: 'offset',
167
169
  options: {
168
- offset: [0, noArrow ? -1 : 10],
170
+ offset: [0, noArrow ? 5 : 10],
169
171
  },
170
172
  },
171
173
  {
@@ -188,10 +190,10 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
188
190
  }, [popperRef]);
189
191
 
190
192
  useEffect(() => {
191
- if (attributes?.popper?.['data-popper-reference-hidden']) {
193
+ if (attributes.popper?.['data-popper-reference-hidden']) {
192
194
  removePopover?.(id);
193
195
  }
194
- }, [attributes?.popper]);
196
+ }, [attributes.popper]);
195
197
 
196
198
  /* Getting the x and y values from the transform property of the popper element. */
197
199
  const translateValues = styles.popper.transform
@@ -217,6 +219,7 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
217
219
  isOpaque={!transparent && !minimal}
218
220
  intent={intent}
219
221
  flat={flat}
222
+ isString={isString(content)}
220
223
  dim={flat && !transparent && !effect && minimal}
221
224
  className='reqore-popover-content'
222
225
  ref={(el) => {