@qoretechnologies/reqore 0.30.5 → 0.30.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +105 -0
- package/CONTRIBUTING.MD +78 -0
- package/LICENSE +1 -1
- package/README.md +44 -2
- package/SECURITY.md +5 -0
- package/__tests__/collection.test.tsx +1 -1
- package/__tests__/{control_group.test.tsx → control_group.text.tsx} +2 -4
- package/__tests__/modal.test.tsx +2 -74
- package/__tests__/panel.test.tsx +24 -96
- package/__tests__/popover.test.tsx +2 -24
- package/__tests__/tabs.test.tsx +0 -75
- package/dist/components/Button/index.d.ts +2 -7
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +20 -30
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +3 -6
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +2 -7
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +53 -57
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +5 -5
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +4 -15
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Columns/column.d.ts.map +1 -1
- package/dist/components/Columns/column.js +1 -1
- package/dist/components/Columns/column.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +4 -21
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +55 -250
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +3 -3
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +16 -27
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +0 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +3 -3
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Effect/index.d.ts +10 -10
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +6 -7
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +6 -5
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +7 -14
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +0 -2
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +4 -10
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +10 -12
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Message/index.d.ts +0 -2
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +2 -2
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +2 -2
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.js +10 -10
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/Notifications/index.d.ts +1 -1
- package/dist/components/Notifications/index.d.ts.map +1 -1
- package/dist/components/Notifications/notification.d.ts +1 -1
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Panel/index.d.ts +6 -13
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +44 -78
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +2 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +2 -2
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Spacer/index.d.ts +0 -2
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spacer/index.js +7 -29
- package/dist/components/Spacer/index.js.map +1 -1
- package/dist/components/Table/header.js +2 -2
- package/dist/components/Table/header.js.map +1 -1
- package/dist/components/Table/headerCell.js +2 -2
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/helpers.d.ts +2 -3
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +3 -6
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +3 -4
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +5 -0
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +7 -3
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tabs/content.d.ts +1 -3
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/content.js +3 -8
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +1 -4
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +4 -12
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +0 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +7 -7
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +6 -7
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.d.ts +2 -2
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +8 -7
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.d.ts +2 -6
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +12 -24
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Tree/index.js +1 -1
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/constants/animations.js +1 -1
- package/dist/constants/sizes.d.ts +2 -2
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +10 -10
- package/dist/constants/sizes.js.map +1 -1
- package/dist/constants/theme.d.ts +1 -1
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.js +8 -10
- package/dist/containers/PopoverProvider.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +2 -4
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +0 -7
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +0 -2
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +2 -6
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/utils.d.ts +0 -3
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +2 -17
- package/dist/helpers/utils.js.map +1 -1
- package/dist/hooks/useLatestZIndex.js +2 -2
- package/dist/hooks/useLatestZIndex.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +0 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +6 -8
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/styles.d.ts +0 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +5 -6
- package/dist/styles.js.map +1 -1
- package/dist/types/global.d.ts +1 -27
- package/dist/types/global.d.ts.map +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.d.ts.map +1 -1
- package/package.json +1 -1
- package/public/logo-dark.png +0 -0
- package/public/logo.png +0 -0
- package/public/q-symbol.png +0 -0
- package/public/qoreLogo-dark.png +0 -0
- package/public/qoreLogo.png +0 -0
- package/src/components/Button/index.tsx +34 -79
- package/src/components/Checkbox/index.tsx +2 -3
- package/src/components/Collection/index.tsx +60 -93
- package/src/components/Collection/item.tsx +9 -29
- package/src/components/Columns/column.tsx +0 -1
- package/src/components/ControlGroup/index.tsx +104 -449
- package/src/components/Drawer/index.tsx +27 -28
- package/src/components/Dropdown/index.tsx +1 -3
- package/src/components/Effect/index.tsx +14 -22
- package/src/components/Icon/index.tsx +62 -81
- package/src/components/Input/index.tsx +3 -8
- package/src/components/InternalPopover/index.tsx +126 -131
- package/src/components/Menu/index.tsx +1 -7
- package/src/components/Message/index.tsx +1 -9
- package/src/components/MultiSelect/index.tsx +188 -180
- package/src/components/Panel/index.tsx +100 -227
- package/src/components/Popover/index.tsx +3 -1
- package/src/components/Spacer/index.tsx +14 -63
- package/src/components/Table/header.tsx +2 -2
- package/src/components/Table/headerCell.tsx +2 -2
- package/src/components/Table/helpers.ts +6 -12
- package/src/components/Table/index.tsx +0 -1
- package/src/components/Table/row.tsx +7 -2
- package/src/components/Tabs/content.tsx +3 -11
- package/src/components/Tabs/index.tsx +3 -14
- package/src/components/Tabs/item.tsx +5 -28
- package/src/components/Tabs/list.tsx +3 -7
- package/src/components/Tag/group.tsx +12 -6
- package/src/components/Tag/index.tsx +35 -69
- package/src/components/Tree/index.tsx +1 -1
- package/src/constants/animations.ts +1 -1
- package/src/constants/sizes.ts +10 -10
- package/src/containers/PopoverProvider.tsx +8 -11
- package/src/containers/ReqoreProvider.tsx +35 -40
- package/src/containers/UIProvider.tsx +0 -7
- package/src/context/ReqoreContext.tsx +0 -2
- package/src/helpers/colors.ts +2 -8
- package/src/helpers/utils.ts +0 -18
- package/src/hooks/useLatestZIndex.ts +2 -2
- package/src/hooks/usePopover.tsx +6 -9
- package/src/mock/collectionData.tsx +2 -33
- package/src/stories/Button/Button.stories.tsx +7 -72
- package/src/stories/Checkbox/Checkbox.stories.tsx +3 -6
- package/src/stories/Collection/Collection.stories.tsx +2 -18
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +33 -282
- package/src/stories/Drawer/Drawer.stories.tsx +3 -70
- package/src/stories/Dropdown/Dropdown.stories.tsx +3 -13
- package/src/stories/Icon/Icon.stories.tsx +0 -1
- package/src/stories/Input/Input.stories.tsx +3 -5
- package/src/stories/Menu/Menu.stories.tsx +0 -2
- package/src/stories/Message/Message.stories.tsx +0 -7
- package/src/stories/Panel/Panel.stories.tsx +13 -147
- package/src/stories/Popover/Popover.stories.tsx +82 -88
- package/src/stories/Tabs/Tabs.stories.tsx +15 -33
- package/src/stories/Tag/Tag.stories.tsx +3 -23
- package/src/stories/TextArea/TextArea.stories.tsx +3 -3
- package/src/styles.ts +0 -6
- package/src/types/global.ts +0 -28
- package/tests.json +1 -1
|
@@ -27,7 +27,7 @@ export interface IReqoreDrawerProps extends Omit<IReqorePanelProps, 'size'> {
|
|
|
27
27
|
onClose?: () => void;
|
|
28
28
|
onHideToggle?: (isHidden: boolean) => void;
|
|
29
29
|
hasBackdrop?: boolean;
|
|
30
|
-
size?: string
|
|
30
|
+
size?: string;
|
|
31
31
|
maxSize?: string;
|
|
32
32
|
minSize?: string;
|
|
33
33
|
opacity?: number;
|
|
@@ -170,7 +170,6 @@ export const ReqoreDrawer = ({
|
|
|
170
170
|
_isModal,
|
|
171
171
|
width,
|
|
172
172
|
height,
|
|
173
|
-
actions = [],
|
|
174
173
|
...rest
|
|
175
174
|
}: IReqoreDrawerProps) => {
|
|
176
175
|
const { animations } = useContext(ReqoreContext);
|
|
@@ -200,13 +199,12 @@ export const ReqoreDrawer = ({
|
|
|
200
199
|
|
|
201
200
|
const zIndex = useLatestZIndex();
|
|
202
201
|
const wrapperZIndex = useLatestZIndex();
|
|
203
|
-
const
|
|
204
|
-
const
|
|
202
|
+
const actions: IReqorePanelAction[] = useMemo(() => {
|
|
203
|
+
const actions: IReqorePanelAction[] = [];
|
|
205
204
|
|
|
206
205
|
/* Adding a hide/show button to the drawer. */
|
|
207
206
|
if (hidable) {
|
|
208
|
-
|
|
209
|
-
responsive: false,
|
|
207
|
+
actions.push({
|
|
210
208
|
icon: getHideShowIcon(position, _isHidden),
|
|
211
209
|
onClick: () => {
|
|
212
210
|
setIsHidden(!_isHidden);
|
|
@@ -220,15 +218,14 @@ export const ReqoreDrawer = ({
|
|
|
220
218
|
|
|
221
219
|
/* Adding a close button to the drawer. */
|
|
222
220
|
if (onClose) {
|
|
223
|
-
|
|
224
|
-
responsive: false,
|
|
221
|
+
actions.push({
|
|
225
222
|
icon: 'CloseLine',
|
|
226
223
|
onClick: onClose,
|
|
227
224
|
className: 'reqore-drawer-close-button',
|
|
228
225
|
});
|
|
229
226
|
}
|
|
230
227
|
|
|
231
|
-
return
|
|
228
|
+
return actions;
|
|
232
229
|
}, [hidable, position, onClose]);
|
|
233
230
|
|
|
234
231
|
const positions = useMemo(() => {
|
|
@@ -266,27 +263,27 @@ export const ReqoreDrawer = ({
|
|
|
266
263
|
/>
|
|
267
264
|
) : null}
|
|
268
265
|
<Resizable
|
|
269
|
-
className=
|
|
266
|
+
className='reqore-drawer-resizable'
|
|
270
267
|
maxHeight={
|
|
271
268
|
layout === 'horizontal' || layout === 'center' ? maxSize || '90vh' : undefined
|
|
272
269
|
}
|
|
273
270
|
minHeight={
|
|
274
271
|
layout === 'center'
|
|
275
|
-
? '
|
|
272
|
+
? '140px'
|
|
276
273
|
: layout === 'horizontal'
|
|
277
274
|
? _isHidden
|
|
278
275
|
? 0
|
|
279
|
-
: minSize || '
|
|
276
|
+
: minSize || '140px'
|
|
280
277
|
: undefined
|
|
281
278
|
}
|
|
282
279
|
maxWidth={layout === 'vertical' || layout === 'center' ? maxSize || '90vw' : undefined}
|
|
283
280
|
minWidth={
|
|
284
281
|
layout === 'center'
|
|
285
|
-
? '
|
|
282
|
+
? '140px'
|
|
286
283
|
: layout === 'vertical'
|
|
287
284
|
? _isHidden
|
|
288
285
|
? 0
|
|
289
|
-
: minSize || '
|
|
286
|
+
: minSize || '140px'
|
|
290
287
|
: undefined
|
|
291
288
|
}
|
|
292
289
|
as={StyledDrawerResizable}
|
|
@@ -345,19 +342,21 @@ export const ReqoreDrawer = ({
|
|
|
345
342
|
<StyledCloseWrapper
|
|
346
343
|
className='reqore-drawer-controls'
|
|
347
344
|
position={position}
|
|
348
|
-
w={layout === 'vertical' ? 0 : _size.width}
|
|
349
|
-
h={layout === 'horizontal' ? 0 : _size.height}
|
|
345
|
+
w={layout === 'vertical' && _isHidden ? 0 : _size.width}
|
|
346
|
+
h={layout === 'horizontal' && _isHidden ? 0 : _size.height}
|
|
350
347
|
>
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
348
|
+
{hidable && (
|
|
349
|
+
<ReqoreButton
|
|
350
|
+
flat
|
|
351
|
+
customTheme={theme}
|
|
352
|
+
className='reqore-drawer-control reqore-drawer-hide-button'
|
|
353
|
+
icon={getHideShowIcon(position, _isHidden)}
|
|
354
|
+
onClick={() => {
|
|
355
|
+
setIsHidden(!_isHidden);
|
|
356
|
+
onHideToggle && onHideToggle(!_isHidden);
|
|
357
|
+
}}
|
|
358
|
+
/>
|
|
359
|
+
)}
|
|
361
360
|
</StyledCloseWrapper>
|
|
362
361
|
) : null}
|
|
363
362
|
{!_isHidden && (
|
|
@@ -365,12 +364,12 @@ export const ReqoreDrawer = ({
|
|
|
365
364
|
{...rest}
|
|
366
365
|
opacity={opacity}
|
|
367
366
|
blur={hasBackdrop ? 0 : blur}
|
|
368
|
-
actions={
|
|
367
|
+
actions={actions}
|
|
369
368
|
customTheme={customTheme}
|
|
370
369
|
intent={intent}
|
|
371
370
|
rounded={floating || _isModal ? true : false}
|
|
372
371
|
flat={flat}
|
|
373
|
-
className={
|
|
372
|
+
className={`${className || ''} reqore-drawer`}
|
|
374
373
|
style={{
|
|
375
374
|
width: '100%',
|
|
376
375
|
maxHeight: '100%',
|
|
@@ -22,7 +22,6 @@ export interface IReqoreDropdownProps extends Partial<IPopoverOptions> {
|
|
|
22
22
|
caretPosition?: 'left' | 'right';
|
|
23
23
|
isDefaultOpen?: boolean;
|
|
24
24
|
onItemSelect?: TDropdownItemOnClick;
|
|
25
|
-
style?: React.CSSProperties;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
@@ -65,7 +64,7 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
65
64
|
...rest,
|
|
66
65
|
icon: caretPosition === 'left' ? icon || 'ArrowDownSFill' : rightIcon,
|
|
67
66
|
rightIcon: caretPosition === 'right' ? icon || 'ArrowDownSFill' : rightIcon,
|
|
68
|
-
style: buttonStyle
|
|
67
|
+
style: buttonStyle,
|
|
69
68
|
disabled: !size(items),
|
|
70
69
|
className: `${(rest as any)?.className || ''} reqore-dropdown-control`,
|
|
71
70
|
} as T),
|
|
@@ -99,7 +98,6 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
99
98
|
useTargetWidth={useTargetWidth}
|
|
100
99
|
component={component || ReqoreButton}
|
|
101
100
|
componentProps={componentProps}
|
|
102
|
-
isReqoreComponent
|
|
103
101
|
noWrapper
|
|
104
102
|
placement={placement || 'bottom-start'}
|
|
105
103
|
handler={handler || 'click'}
|
|
@@ -114,16 +114,10 @@ export const StyledEffect = styled.span`
|
|
|
114
114
|
const gradientColors = createEffectGradient(
|
|
115
115
|
theme,
|
|
116
116
|
effect.gradient.colors,
|
|
117
|
-
|
|
117
|
+
0,
|
|
118
118
|
!isText && minimal && !active
|
|
119
119
|
);
|
|
120
|
-
const gradientColorsActive = createEffectGradient(
|
|
121
|
-
theme,
|
|
122
|
-
effect.gradient.colors,
|
|
123
|
-
0.05,
|
|
124
|
-
minimal,
|
|
125
|
-
true
|
|
126
|
-
);
|
|
120
|
+
const gradientColorsActive = createEffectGradient(theme, effect.gradient.colors, 0.05);
|
|
127
121
|
|
|
128
122
|
const gradientDirectionOrShape =
|
|
129
123
|
gradientType === 'linear'
|
|
@@ -173,17 +167,16 @@ export const StyledEffect = styled.span`
|
|
|
173
167
|
background: ${active ? gradientActive : gradient};
|
|
174
168
|
border-color: ${borderColor} !important;
|
|
175
169
|
|
|
176
|
-
${color &&
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
: undefined}
|
|
170
|
+
${color &&
|
|
171
|
+
css`
|
|
172
|
+
color: ${getReadableColorFrom(getColorFromMaybeString(theme, color), false)} !important;
|
|
173
|
+
&::placeholder {
|
|
174
|
+
color: ${rgba(
|
|
175
|
+
getReadableColorFrom(getColorFromMaybeString(theme, color), false),
|
|
176
|
+
0.7
|
|
177
|
+
)} !important;
|
|
178
|
+
}
|
|
179
|
+
`}
|
|
187
180
|
|
|
188
181
|
${effect.gradient.animate === 'always' || (effect.gradient.animate === 'active' && active)
|
|
189
182
|
? css`
|
|
@@ -276,7 +269,6 @@ export const StyledEffect = styled.span`
|
|
|
276
269
|
white-space: nowrap;
|
|
277
270
|
text-overflow: ellipsis;
|
|
278
271
|
overflow: hidden;
|
|
279
|
-
min-width: 30px;
|
|
280
272
|
`
|
|
281
273
|
: undefined}
|
|
282
274
|
|
|
@@ -372,9 +364,9 @@ export const ReqoreEffect = ({ children, ...rest }: IReqoreTextEffectProps) => {
|
|
|
372
364
|
);
|
|
373
365
|
};
|
|
374
366
|
|
|
375
|
-
export const ReqoreTextEffect = ({ children,
|
|
367
|
+
export const ReqoreTextEffect = ({ children, ...rest }: IReqoreTextEffectProps) => {
|
|
376
368
|
return (
|
|
377
|
-
<StyledTextEffect className=
|
|
369
|
+
<StyledTextEffect className='reqore-text-effect' {...rest}>
|
|
378
370
|
{children}
|
|
379
371
|
</StyledTextEffect>
|
|
380
372
|
);
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { memo, useContext } from 'react';
|
|
2
2
|
import { IconContext } from 'react-icons';
|
|
3
3
|
import { IconBaseProps, IconType } from 'react-icons/lib';
|
|
4
4
|
import * as RemixIcons from 'react-icons/ri';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import { ReqoreThemeContext } from '../..';
|
|
7
7
|
import { ICON_FROM_SIZE, PADDING_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
8
|
-
import {
|
|
8
|
+
import { TReqoreIntent } from '../../constants/theme';
|
|
9
9
|
import { isStringSize } from '../../helpers/utils';
|
|
10
|
-
import {
|
|
11
|
-
import { useTooltip } from '../../hooks/useTooltip';
|
|
12
|
-
import { IReqoreIntent, IWithReqoreEffect, IWithReqoreTooltip } from '../../types/global';
|
|
10
|
+
import { IWithReqoreEffect } from '../../types/global';
|
|
13
11
|
import { IReqoreIconName } from '../../types/icons';
|
|
14
|
-
import { StyledEffect
|
|
12
|
+
import { StyledEffect } from '../Effect';
|
|
15
13
|
|
|
16
|
-
export interface IReqoreIconProps
|
|
17
|
-
extends React.HTMLAttributes<HTMLSpanElement>,
|
|
18
|
-
IWithReqoreEffect,
|
|
19
|
-
IWithReqoreTooltip,
|
|
20
|
-
IReqoreIntent {
|
|
14
|
+
export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement>, IWithReqoreEffect {
|
|
21
15
|
icon?: IReqoreIconName;
|
|
22
|
-
color?:
|
|
16
|
+
color?: string;
|
|
23
17
|
size?: TSizes | string;
|
|
24
18
|
iconProps?: IconBaseProps;
|
|
19
|
+
intent?: TReqoreIntent;
|
|
25
20
|
margin?: 'right' | 'left' | 'both';
|
|
26
21
|
image?: string;
|
|
27
22
|
rounded?: boolean;
|
|
@@ -57,85 +52,71 @@ export const StyledIconWrapper = styled(StyledEffect)<{ margin: 'right' | 'left'
|
|
|
57
52
|
`;
|
|
58
53
|
|
|
59
54
|
const ReqoreIcon = memo(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
) => {
|
|
77
|
-
const { targetRef } = useCombinedRefs(ref);
|
|
78
|
-
const theme = useContext(ReqoreThemeContext);
|
|
79
|
-
const Icon: IconType = RemixIcons[`Ri${icon}`];
|
|
80
|
-
const finalColor: string | undefined = intent
|
|
81
|
-
? theme.intents[intent]
|
|
82
|
-
: getColorFromMaybeString(theme, color);
|
|
83
|
-
const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
|
|
84
|
-
|
|
85
|
-
useTooltip(targetRef.current, tooltip);
|
|
86
|
-
|
|
87
|
-
if (image) {
|
|
88
|
-
return (
|
|
89
|
-
<StyledIconWrapper
|
|
90
|
-
{...rest}
|
|
91
|
-
ref={targetRef}
|
|
92
|
-
size={size}
|
|
93
|
-
margin={margin}
|
|
94
|
-
className={`${className || ''} reqore-icon`}
|
|
95
|
-
style={{ ...style, width: finalSize, height: finalSize }}
|
|
96
|
-
>
|
|
97
|
-
<img src={image} alt='' />
|
|
98
|
-
</StyledIconWrapper>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (!Icon) {
|
|
103
|
-
return (
|
|
104
|
-
<StyledIconWrapper
|
|
105
|
-
{...rest}
|
|
106
|
-
ref={targetRef}
|
|
107
|
-
size={size}
|
|
108
|
-
margin={margin}
|
|
109
|
-
className={`${className || ''} reqore-icon`}
|
|
110
|
-
style={{ ...style, width: finalSize, height: finalSize }}
|
|
111
|
-
/>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
55
|
+
({
|
|
56
|
+
icon,
|
|
57
|
+
size = 'normal',
|
|
58
|
+
className,
|
|
59
|
+
color,
|
|
60
|
+
margin,
|
|
61
|
+
style = {},
|
|
62
|
+
iconProps,
|
|
63
|
+
intent,
|
|
64
|
+
image,
|
|
65
|
+
...rest
|
|
66
|
+
}: IReqoreIconProps) => {
|
|
67
|
+
const theme = useContext(ReqoreThemeContext);
|
|
68
|
+
const Icon: IconType = RemixIcons[`Ri${icon}`];
|
|
69
|
+
const finalColor: string | undefined = intent ? theme.intents[intent] : color;
|
|
70
|
+
const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
|
|
114
71
|
|
|
72
|
+
if (image) {
|
|
115
73
|
return (
|
|
116
74
|
<StyledIconWrapper
|
|
117
75
|
{...rest}
|
|
118
|
-
ref={targetRef}
|
|
119
|
-
margin={margin}
|
|
120
76
|
size={size}
|
|
121
|
-
|
|
77
|
+
margin={margin}
|
|
122
78
|
className={`${className || ''} reqore-icon`}
|
|
79
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
123
80
|
>
|
|
124
|
-
<
|
|
125
|
-
value={{
|
|
126
|
-
color: finalColor || 'inherit',
|
|
127
|
-
size: finalSize,
|
|
128
|
-
style: {
|
|
129
|
-
verticalAlign: 'super',
|
|
130
|
-
},
|
|
131
|
-
}}
|
|
132
|
-
>
|
|
133
|
-
<Icon {...iconProps} />
|
|
134
|
-
</IconContext.Provider>
|
|
81
|
+
<img src={image} alt='' />
|
|
135
82
|
</StyledIconWrapper>
|
|
136
83
|
);
|
|
137
84
|
}
|
|
138
|
-
|
|
85
|
+
|
|
86
|
+
if (!Icon) {
|
|
87
|
+
return (
|
|
88
|
+
<StyledIconWrapper
|
|
89
|
+
{...rest}
|
|
90
|
+
size={size}
|
|
91
|
+
margin={margin}
|
|
92
|
+
className={`${className || ''} reqore-icon`}
|
|
93
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<StyledIconWrapper
|
|
100
|
+
{...rest}
|
|
101
|
+
margin={margin}
|
|
102
|
+
size={size}
|
|
103
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
104
|
+
className={`${className || ''} reqore-icon`}
|
|
105
|
+
>
|
|
106
|
+
<IconContext.Provider
|
|
107
|
+
value={{
|
|
108
|
+
color: finalColor || 'inherit',
|
|
109
|
+
size: finalSize,
|
|
110
|
+
style: {
|
|
111
|
+
verticalAlign: 'super',
|
|
112
|
+
},
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
<Icon {...iconProps} />
|
|
116
|
+
</IconContext.Provider>
|
|
117
|
+
</StyledIconWrapper>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
139
120
|
);
|
|
140
121
|
|
|
141
122
|
export default ReqoreIcon;
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
IWithReqoreEffect,
|
|
23
23
|
} from '../../types/global';
|
|
24
24
|
import { IReqoreIconName } from '../../types/icons';
|
|
25
|
-
import { StyledEffect
|
|
25
|
+
import { StyledEffect } from '../Effect';
|
|
26
26
|
import ReqoreIcon from '../Icon';
|
|
27
27
|
import ReqoreInputClearButton from '../InputClearButton';
|
|
28
28
|
|
|
@@ -48,7 +48,6 @@ export interface IReqoreInputProps
|
|
|
48
48
|
rounded?: boolean;
|
|
49
49
|
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url';
|
|
50
50
|
wrapperStyle?: React.CSSProperties;
|
|
51
|
-
iconColor?: TReqoreEffectColor;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
@@ -61,10 +60,7 @@ export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
|
61
60
|
export const StyledInputWrapper = styled.div<IReqoreInputStyle>`
|
|
62
61
|
height: ${({ _size }) => SIZE_TO_PX[_size]}px;
|
|
63
62
|
width: ${({ width }) => (width ? `${width}px` : 'auto')};
|
|
64
|
-
|
|
65
|
-
min-width: 60px;
|
|
66
|
-
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 1 auto')};
|
|
67
|
-
align-self: ${({ fixed, fluid }) => (fixed ? 'flex-start' : fluid ? 'stretch' : undefined)};
|
|
63
|
+
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 0 auto' : '0 0 auto')};
|
|
68
64
|
font-size: ${({ _size }) => TEXT_FROM_SIZE[_size]}px;
|
|
69
65
|
position: relative;
|
|
70
66
|
overflow: hidden;
|
|
@@ -154,7 +150,6 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
154
150
|
className,
|
|
155
151
|
onClearClick,
|
|
156
152
|
icon,
|
|
157
|
-
iconColor,
|
|
158
153
|
flat,
|
|
159
154
|
rounded = true,
|
|
160
155
|
minimal,
|
|
@@ -190,7 +185,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
190
185
|
>
|
|
191
186
|
{icon && (
|
|
192
187
|
<StyledIconWrapper _size={size}>
|
|
193
|
-
<ReqoreIcon size={size} icon={icon}
|
|
188
|
+
<ReqoreIcon size={size} icon={icon} />
|
|
194
189
|
</StyledIconWrapper>
|
|
195
190
|
)}
|
|
196
191
|
<StyledInput
|