@qoretechnologies/reqore 0.29.2 → 0.29.4
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/__tests__/collection.test.tsx +1 -1
- package/__tests__/multiselect.test.tsx +59 -75
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +3 -2
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +19 -14
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +2 -1
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +14 -7
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +1 -0
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +19 -20
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +1 -1
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Effect/index.d.ts +1 -0
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +2 -2
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +6 -6
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.js +17 -19
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +1 -2
- 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 +15 -1
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spacer/index.js +87 -10
- package/dist/components/Spacer/index.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 +7 -8
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.js +2 -2
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +1 -0
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/constants/sizes.d.ts +1 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +1 -0
- package/dist/constants/sizes.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +1 -0
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +1 -1
- package/src/components/Checkbox/index.tsx +1 -1
- package/src/components/Collection/index.tsx +25 -10
- package/src/components/Collection/item.tsx +15 -1
- package/src/components/ControlGroup/index.tsx +32 -31
- package/src/components/Dropdown/index.tsx +1 -0
- package/src/components/Effect/index.tsx +5 -2
- package/src/components/InternalPopover/index.tsx +7 -6
- package/src/components/MultiSelect/index.tsx +21 -23
- package/src/components/Popover/index.tsx +1 -3
- package/src/components/Spacer/index.tsx +90 -5
- package/src/components/Tag/group.tsx +6 -12
- package/src/components/Tag/index.tsx +2 -2
- package/src/components/Textarea/index.tsx +2 -0
- package/src/constants/sizes.ts +1 -0
- package/src/hooks/usePopover.tsx +1 -0
- package/src/index.tsx +1 -1
- package/src/mock/collectionData.tsx +7 -0
- package/src/mock/multiSelect.ts +1 -1
- package/src/stories/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/stories/Collection/Collection.stories.tsx +2 -1
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +23 -3
- package/src/stories/Menu/Menu.stories.tsx +1 -0
- package/src/stories/MultiSelect/MultiSelect.stories.tsx +4 -1
- package/src/stories/Popover/Popover.stories.tsx +85 -79
- package/src/stories/Spacer/Spacer.stories.tsx +93 -0
- package/src/stories/Tag/Tag.stories.tsx +3 -1
- package/src/stories/TextArea/TextArea.stories.tsx +2 -2
- package/tests.json +1 -1
|
@@ -18,6 +18,7 @@ export interface IReqoreControlGroupProps
|
|
|
18
18
|
* Whether the contents of the control group should be stacked vertically
|
|
19
19
|
*/
|
|
20
20
|
vertical?: boolean;
|
|
21
|
+
wrap?: boolean;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export interface IReqoreControlGroupStyle extends IReqoreControlGroupProps {
|
|
@@ -30,6 +31,8 @@ export const StyledReqoreControlGroup = styled.div<IReqoreControlGroupStyle>`
|
|
|
30
31
|
width: ${({ fluid }) => (fluid ? '100%' : undefined)};
|
|
31
32
|
align-items: ${({ fluid }) => (fluid ? 'stretch' : 'flex-start')};
|
|
32
33
|
flex-flow: ${({ vertical }) => (vertical ? 'column' : 'row')};
|
|
34
|
+
gap: ${({ gapSize, stack }) => (!stack ? `${GAP_FROM_SIZE[gapSize]}px` : undefined)};
|
|
35
|
+
flex-wrap: ${({ wrap }) => (wrap ? 'wrap' : 'nowrap')};
|
|
33
36
|
|
|
34
37
|
> .reqore-control-wrapper .reqore-control {
|
|
35
38
|
border-radius: ${({ stack }) => (!stack ? undefined : 0)};
|
|
@@ -43,31 +46,28 @@ export const StyledReqoreControlGroup = styled.div<IReqoreControlGroupStyle>`
|
|
|
43
46
|
> .reqore-tag,
|
|
44
47
|
> * {
|
|
45
48
|
&:not(:last-child) {
|
|
46
|
-
margin-bottom: ${({ stack, gapSize }) =>
|
|
47
|
-
!stack ? `${GAP_FROM_SIZE[gapSize]}px` : undefined};
|
|
48
49
|
border-bottom: ${({ stack }) => (!stack ? undefined : 0)};
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
border-radius: ${({ stack }) => (!stack ? undefined : 0)};
|
|
52
53
|
|
|
53
|
-
${({ rounded, size }) =>
|
|
54
|
-
rounded &&
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
${({ rounded, size, stack }) =>
|
|
55
|
+
rounded && stack
|
|
56
|
+
? css`
|
|
57
|
+
&:first-child {
|
|
58
|
+
border-top-left-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
59
|
+
border-top-right-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
60
|
+
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
&:last-child {
|
|
63
|
+
border-bottom-left-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
64
|
+
border-bottom-right-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
65
|
+
}
|
|
66
|
+
`
|
|
67
|
+
: undefined}
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
> .reqore-control-wrapper:not(:last-child) .reqore-control {
|
|
69
|
-
margin-bottom: ${({ stack, gapSize }) =>
|
|
70
|
-
!stack ? `${GAP_FROM_SIZE[gapSize]}px` : undefined};
|
|
71
71
|
border-bottom: ${({ stack }) => (!stack ? undefined : 0)};
|
|
72
72
|
}
|
|
73
73
|
`
|
|
@@ -77,26 +77,25 @@ export const StyledReqoreControlGroup = styled.div<IReqoreControlGroupStyle>`
|
|
|
77
77
|
> .reqore-tag,
|
|
78
78
|
> * {
|
|
79
79
|
&:not(:last-child) {
|
|
80
|
-
margin-right: ${({ stack, gapSize }) =>
|
|
81
|
-
!stack ? `${GAP_FROM_SIZE[gapSize]}px` : undefined};
|
|
82
80
|
border-right: ${({ stack }) => (!stack ? undefined : 0)};
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
border-radius: ${({ stack }) => (!stack ? undefined : 0)};
|
|
86
84
|
|
|
87
|
-
${({ rounded, size }) =>
|
|
88
|
-
rounded &&
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
${({ rounded, size, stack }) =>
|
|
86
|
+
rounded && stack
|
|
87
|
+
? css`
|
|
88
|
+
&:first-child {
|
|
89
|
+
border-top-left-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
90
|
+
border-bottom-left-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
91
|
+
}
|
|
94
92
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
&:last-child {
|
|
94
|
+
border-top-right-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
95
|
+
border-bottom-right-radius: ${RADIUS_FROM_SIZE[size]}px;
|
|
96
|
+
}
|
|
97
|
+
`
|
|
98
|
+
: undefined}
|
|
100
99
|
}
|
|
101
100
|
`}
|
|
102
101
|
`;
|
|
@@ -112,6 +111,7 @@ const ReqoreControlGroup = forwardRef<HTMLDivElement, IReqoreControlGroupProps>(
|
|
|
112
111
|
fluid,
|
|
113
112
|
flat,
|
|
114
113
|
rounded = true,
|
|
114
|
+
wrap,
|
|
115
115
|
...rest
|
|
116
116
|
}: IReqoreControlGroupProps,
|
|
117
117
|
ref
|
|
@@ -123,6 +123,7 @@ const ReqoreControlGroup = forwardRef<HTMLDivElement, IReqoreControlGroupProps>(
|
|
|
123
123
|
ref={ref}
|
|
124
124
|
rounded={rounded}
|
|
125
125
|
fluid={fluid}
|
|
126
|
+
wrap={wrap}
|
|
126
127
|
className={`${className || ''} reqore-control-group`}
|
|
127
128
|
>
|
|
128
129
|
{React.Children.map(children, (child) =>
|
|
@@ -134,7 +135,7 @@ const ReqoreControlGroup = forwardRef<HTMLDivElement, IReqoreControlGroupProps>(
|
|
|
134
135
|
: minimal,
|
|
135
136
|
size: child.props?.size || size,
|
|
136
137
|
flat: child.props?.flat || child.props?.flat === false ? child.props.flat : flat,
|
|
137
|
-
fluid,
|
|
138
|
+
fluid: child.props?.fluid || child.props?.fluid === false ? child.props.fluid : fluid,
|
|
138
139
|
})
|
|
139
140
|
: null
|
|
140
141
|
)}
|
|
@@ -98,6 +98,7 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
98
98
|
useTargetWidth={useTargetWidth}
|
|
99
99
|
component={component || ReqoreButton}
|
|
100
100
|
componentProps={componentProps}
|
|
101
|
+
isReqoreComponent
|
|
101
102
|
noWrapper
|
|
102
103
|
placement={placement || 'bottom-start'}
|
|
103
104
|
handler={handler || 'click'}
|
|
@@ -59,6 +59,7 @@ export interface IReqoreEffect extends IReqoreEffectFilters {
|
|
|
59
59
|
direction?: string;
|
|
60
60
|
borderColor?: TReqoreEffectColor;
|
|
61
61
|
animate?: TReqoreEffectGradientAnimationTrigger;
|
|
62
|
+
animationSpeed?: 1 | 2 | 3 | 4 | 5;
|
|
62
63
|
};
|
|
63
64
|
noWrap?: boolean;
|
|
64
65
|
color?: TReqoreEffectColor;
|
|
@@ -180,7 +181,8 @@ export const StyledEffect = styled.span`
|
|
|
180
181
|
${effect.gradient.animate === 'always' || (effect.gradient.animate === 'active' && active)
|
|
181
182
|
? css`
|
|
182
183
|
background-size: 200% 200%;
|
|
183
|
-
animation: ${StyledGradientKeyframes}
|
|
184
|
+
animation: ${StyledGradientKeyframes} ${effect.gradient.animationSpeed || 2}s linear
|
|
185
|
+
infinite;
|
|
184
186
|
`
|
|
185
187
|
: undefined}
|
|
186
188
|
|
|
@@ -199,7 +201,8 @@ export const StyledEffect = styled.span`
|
|
|
199
201
|
effect.gradient.animate === 'always'
|
|
200
202
|
? css`
|
|
201
203
|
background-size: 200% 200%;
|
|
202
|
-
animation: ${StyledGradientKeyframes}
|
|
204
|
+
animation: ${StyledGradientKeyframes} ${effect.gradient.animationSpeed || 2}s linear
|
|
205
|
+
infinite;
|
|
203
206
|
`
|
|
204
207
|
: undefined}
|
|
205
208
|
}
|
|
@@ -62,8 +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,
|
|
66
|
-
!flat &&
|
|
65
|
+
border: ${({ flat, noWrapper, ...rest }: any) =>
|
|
66
|
+
!flat && noWrapper ? `1px solid ${getPopoverArrowColor({ ...rest, flat })}` : undefined};
|
|
67
67
|
|
|
68
68
|
${({ transparent }) =>
|
|
69
69
|
!transparent &&
|
|
@@ -129,7 +129,7 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
|
129
129
|
}
|
|
130
130
|
`;
|
|
131
131
|
|
|
132
|
-
const StyledPopoverContent = styled.div
|
|
132
|
+
const StyledPopoverContent = styled.div`
|
|
133
133
|
width: 100%;
|
|
134
134
|
height: 100%;
|
|
135
135
|
z-index: 20;
|
|
@@ -145,6 +145,7 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
145
145
|
id,
|
|
146
146
|
placement,
|
|
147
147
|
noArrow,
|
|
148
|
+
noWrapper,
|
|
148
149
|
useTargetWidth,
|
|
149
150
|
transparent,
|
|
150
151
|
maxWidth,
|
|
@@ -219,7 +220,7 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
219
220
|
isOpaque={!transparent && !minimal}
|
|
220
221
|
intent={intent}
|
|
221
222
|
flat={flat}
|
|
222
|
-
|
|
223
|
+
noWrapper={noWrapper}
|
|
223
224
|
dim={flat && !transparent && !effect && minimal}
|
|
224
225
|
className='reqore-popover-content'
|
|
225
226
|
ref={(el) => {
|
|
@@ -236,8 +237,8 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
236
237
|
{!noArrow && !transparent ? (
|
|
237
238
|
<StyledPopoverArrow ref={setArrowElement} style={styles.arrow} data-popper-arrow />
|
|
238
239
|
) : null}
|
|
239
|
-
<StyledPopoverContent
|
|
240
|
-
{isString(content) ? (
|
|
240
|
+
<StyledPopoverContent>
|
|
241
|
+
{!noWrapper || isString(content) ? (
|
|
241
242
|
<ReqoreMessage
|
|
242
243
|
opaque={!transparent && !minimal}
|
|
243
244
|
className='reqore-popover-text'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { omit, size } from 'lodash';
|
|
2
2
|
import { forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { useUpdateEffect } from 'react-use';
|
|
4
3
|
import { ReqoreDropdown, ReqoreInput } from '../..';
|
|
5
4
|
import { TSizes } from '../../constants/sizes';
|
|
6
5
|
import { IPopoverControls } from '../../hooks/usePopover';
|
|
@@ -18,7 +17,7 @@ export type TReqoreMultiSelectItem = Omit<IReqoreDropdownItem, 'color'> &
|
|
|
18
17
|
export interface IReqoreMultiSelectProps
|
|
19
18
|
extends Omit<IReqoreControlGroupProps, 'children' | 'vertical' | 'stack'> {
|
|
20
19
|
value?: string[];
|
|
21
|
-
onValueChange
|
|
20
|
+
onValueChange: (value: string[]) => void;
|
|
22
21
|
items?: TReqoreMultiSelectItem[];
|
|
23
22
|
onItemClick?: (item: IReqoreDropdownItem) => void;
|
|
24
23
|
onItemClickIcon?: IReqoreTagProps['rightIcon'];
|
|
@@ -61,7 +60,15 @@ export const ReqoreMultiSelectItem = memo(
|
|
|
61
60
|
effect={!item.intent ? item.effect || selectedItemEffect : undefined}
|
|
62
61
|
size={selectedItemSize}
|
|
63
62
|
onClick={onClick}
|
|
64
|
-
rightIcon={
|
|
63
|
+
rightIcon={
|
|
64
|
+
item.disabled
|
|
65
|
+
? undefined
|
|
66
|
+
: item.rightIcon
|
|
67
|
+
? item.rightIcon
|
|
68
|
+
: onClick
|
|
69
|
+
? onItemClickIcon
|
|
70
|
+
: undefined
|
|
71
|
+
}
|
|
65
72
|
/>
|
|
66
73
|
);
|
|
67
74
|
}
|
|
@@ -70,7 +77,7 @@ export const ReqoreMultiSelectItem = memo(
|
|
|
70
77
|
export const ReqoreMultiSelect = forwardRef<HTMLDivElement, IReqoreMultiSelectProps>(
|
|
71
78
|
(
|
|
72
79
|
{
|
|
73
|
-
value,
|
|
80
|
+
value = [],
|
|
74
81
|
onValueChange,
|
|
75
82
|
onItemClick,
|
|
76
83
|
canRemoveItems,
|
|
@@ -86,20 +93,11 @@ export const ReqoreMultiSelect = forwardRef<HTMLDivElement, IReqoreMultiSelectPr
|
|
|
86
93
|
}: IReqoreMultiSelectProps,
|
|
87
94
|
ref
|
|
88
95
|
) => {
|
|
89
|
-
const [_value, setValue] = useState<string[]>(value || []);
|
|
90
96
|
const [createdItems, setCreatedItems] = useState<TReqoreMultiSelectItem[]>([]);
|
|
91
97
|
const [query, setQuery] = useState<string>('');
|
|
92
98
|
const popoverData = useRef<IPopoverControls>(undefined);
|
|
93
99
|
const [focused, setFocused] = useState<boolean>(false);
|
|
94
100
|
|
|
95
|
-
useUpdateEffect(() => {
|
|
96
|
-
onValueChange?.(_value);
|
|
97
|
-
}, [_value]);
|
|
98
|
-
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
setValue(value || []);
|
|
101
|
-
}, [value]);
|
|
102
|
-
|
|
103
101
|
useEffect(() => {
|
|
104
102
|
if (query && !popoverData.current?.isOpen()) {
|
|
105
103
|
popoverData.current?.open();
|
|
@@ -118,13 +116,13 @@ export const ReqoreMultiSelect = forwardRef<HTMLDivElement, IReqoreMultiSelectPr
|
|
|
118
116
|
|
|
119
117
|
const addRemoveItem = useCallback(
|
|
120
118
|
(item: TReqoreMultiSelectItem): void => {
|
|
121
|
-
if (
|
|
122
|
-
|
|
119
|
+
if (value.includes(item.value)) {
|
|
120
|
+
onValueChange(value.filter((v) => v !== item.value));
|
|
123
121
|
} else {
|
|
124
|
-
|
|
122
|
+
onValueChange([...value, item.value]);
|
|
125
123
|
}
|
|
126
124
|
},
|
|
127
|
-
[
|
|
125
|
+
[value]
|
|
128
126
|
);
|
|
129
127
|
|
|
130
128
|
const handleItemSelect = useCallback(
|
|
@@ -142,7 +140,7 @@ export const ReqoreMultiSelect = forwardRef<HTMLDivElement, IReqoreMultiSelectPr
|
|
|
142
140
|
|
|
143
141
|
setQuery('');
|
|
144
142
|
},
|
|
145
|
-
[createdItems,
|
|
143
|
+
[createdItems, value]
|
|
146
144
|
);
|
|
147
145
|
|
|
148
146
|
/*
|
|
@@ -168,7 +166,7 @@ export const ReqoreMultiSelect = forwardRef<HTMLDivElement, IReqoreMultiSelectPr
|
|
|
168
166
|
// Mark selected items as selected
|
|
169
167
|
filteredItems = filteredItems.map((item: TReqoreMultiSelectItem) => ({
|
|
170
168
|
...omit(item, ['actions', 'asBadge', 'rightIcon']),
|
|
171
|
-
selected:
|
|
169
|
+
selected: value.includes(item.value),
|
|
172
170
|
}));
|
|
173
171
|
|
|
174
172
|
if (query && !size(filteredItems)) {
|
|
@@ -207,7 +205,7 @@ export const ReqoreMultiSelect = forwardRef<HTMLDivElement, IReqoreMultiSelectPr
|
|
|
207
205
|
}
|
|
208
206
|
|
|
209
207
|
return filteredItems;
|
|
210
|
-
}, [items, createdItems, query,
|
|
208
|
+
}, [items, createdItems, query, value]);
|
|
211
209
|
|
|
212
210
|
const handleKeyDown = useCallback(
|
|
213
211
|
(e: KeyboardEvent) => {
|
|
@@ -231,14 +229,14 @@ export const ReqoreMultiSelect = forwardRef<HTMLDivElement, IReqoreMultiSelectPr
|
|
|
231
229
|
(value: string): TReqoreMultiSelectItem => {
|
|
232
230
|
return [...items, ...createdItems].find((item) => item.value === value);
|
|
233
231
|
},
|
|
234
|
-
[items, createdItems,
|
|
232
|
+
[items, createdItems, value]
|
|
235
233
|
);
|
|
236
234
|
|
|
237
235
|
return (
|
|
238
236
|
<ReqoreControlGroup vertical fluid {...rest} ref={ref}>
|
|
239
237
|
<ReqoreTagGroup minimal={rest.minimal} size={rest.size}>
|
|
240
|
-
{size(
|
|
241
|
-
|
|
238
|
+
{size(value) ? (
|
|
239
|
+
value.map((v) => (
|
|
242
240
|
<ReqoreMultiSelectItem
|
|
243
241
|
key={v}
|
|
244
242
|
item={getItemByValue(v)}
|
|
@@ -8,7 +8,6 @@ export interface IReqorePopoverProps extends IReqoreComponent, IPopoverOptions {
|
|
|
8
8
|
componentProps?: any;
|
|
9
9
|
children?: any;
|
|
10
10
|
isReqoreComponent?: boolean;
|
|
11
|
-
noWrapper?: boolean;
|
|
12
11
|
wrapperTag?: string;
|
|
13
12
|
wrapperStyle?: React.CSSProperties;
|
|
14
13
|
}
|
|
@@ -23,7 +22,6 @@ const Popover = memo(
|
|
|
23
22
|
componentProps,
|
|
24
23
|
children,
|
|
25
24
|
isReqoreComponent,
|
|
26
|
-
noWrapper,
|
|
27
25
|
wrapperTag = 'span',
|
|
28
26
|
wrapperStyle = {},
|
|
29
27
|
passPopoverData,
|
|
@@ -39,7 +37,7 @@ const Popover = memo(
|
|
|
39
37
|
passPopoverData?.(popoverData);
|
|
40
38
|
}, [popoverData]);
|
|
41
39
|
|
|
42
|
-
if (isReqoreComponent
|
|
40
|
+
if (isReqoreComponent) {
|
|
43
41
|
return (
|
|
44
42
|
<Component
|
|
45
43
|
{...componentProps}
|
|
@@ -1,8 +1,93 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { SIZE_TO_NUMBER, TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
4
|
+
import { changeLightness } from '../../helpers/colors';
|
|
5
|
+
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
6
|
+
import { IReqoreIntent, IWithReqoreCustomTheme, IWithReqoreEffect } from '../../types/global';
|
|
7
|
+
import { StyledEffect } from '../Effect';
|
|
2
8
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
export const StyledSpacer = styled(StyledEffect)`
|
|
10
|
+
${({ horizontal, vertical, width, height, lineSize }) => {
|
|
11
|
+
if (horizontal) {
|
|
12
|
+
return css`
|
|
13
|
+
margin-left: ${width / 2}px;
|
|
14
|
+
margin-right: ${width / 2}px;
|
|
15
|
+
width: ${lineSize === 'none' ? 1 : SIZE_TO_NUMBER[lineSize]}px;
|
|
16
|
+
height: ${height ? `${height}px` : `${TEXT_FROM_SIZE.normal}px`};
|
|
17
|
+
vertical-align: middle;
|
|
18
|
+
display: inline-block;
|
|
19
|
+
`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (vertical) {
|
|
23
|
+
return css`
|
|
24
|
+
margin-top: ${height / 2}px;
|
|
25
|
+
margin-bottom: ${height / 2}px;
|
|
26
|
+
height: ${lineSize === 'none' ? 1 : SIZE_TO_NUMBER[lineSize]}px;
|
|
27
|
+
width: ${width ? `${width}px` : '100%'};
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
}}
|
|
31
|
+
|
|
32
|
+
background-color: ${({ theme, lineSize }) =>
|
|
33
|
+
lineSize === 'none' ? 'transparent' : changeLightness(theme.main, 0.2)};
|
|
7
34
|
flex-shrink: 0;
|
|
8
35
|
`;
|
|
36
|
+
|
|
37
|
+
export interface IReqoreSpacerProps
|
|
38
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
39
|
+
IWithReqoreEffect,
|
|
40
|
+
IWithReqoreCustomTheme,
|
|
41
|
+
IReqoreIntent {
|
|
42
|
+
width?: number;
|
|
43
|
+
height?: number;
|
|
44
|
+
lineSize?: TSizes | 'none';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const ReqoreSpacer = memo(
|
|
48
|
+
({
|
|
49
|
+
customTheme,
|
|
50
|
+
intent,
|
|
51
|
+
lineSize = 'none',
|
|
52
|
+
...rest
|
|
53
|
+
}: IReqoreSpacerProps & { horizontal?: boolean; vertical?: boolean }) => {
|
|
54
|
+
const theme = useReqoreTheme('main', customTheme, intent);
|
|
55
|
+
let { horizontal, vertical } = rest;
|
|
56
|
+
|
|
57
|
+
// The user is using old version of the component
|
|
58
|
+
// We will assume that the user wants a spacer based on the width or height
|
|
59
|
+
if (!horizontal && !vertical) {
|
|
60
|
+
if (rest.width) {
|
|
61
|
+
horizontal = true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (rest.height) {
|
|
65
|
+
vertical = true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<StyledSpacer
|
|
71
|
+
as='div'
|
|
72
|
+
{...rest}
|
|
73
|
+
theme={theme}
|
|
74
|
+
lineSize={lineSize}
|
|
75
|
+
horizontal={horizontal}
|
|
76
|
+
vertical={vertical}
|
|
77
|
+
className='reqore-spacer'
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
export const ReqoreHorizontalSpacer = memo(
|
|
84
|
+
({ width = 1, lineSize = 'none', ...rest }: IReqoreSpacerProps) => {
|
|
85
|
+
return <ReqoreSpacer width={width} lineSize={lineSize} horizontal {...rest} />;
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export const ReqoreVerticalSpacer = memo(
|
|
90
|
+
({ height = 1, lineSize = 'none', ...rest }: IReqoreSpacerProps) => {
|
|
91
|
+
return <ReqoreSpacer height={height} lineSize={lineSize} vertical {...rest} />;
|
|
92
|
+
}
|
|
93
|
+
);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { StyledTag } from '.';
|
|
4
3
|
import { GAP_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
5
4
|
import { IWithReqoreMinimal, IWithReqoreSize } from '../../types/global';
|
|
6
5
|
|
|
@@ -11,19 +10,14 @@ export interface IReqoreTagGroup
|
|
|
11
10
|
children: any;
|
|
12
11
|
gapSize?: TSizes;
|
|
13
12
|
columns?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
14
|
-
|
|
13
|
+
wrap?: boolean;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
const StyledTagGroup = styled.div`
|
|
18
17
|
flex-shrink: 0;
|
|
19
|
-
|
|
20
|
-
${
|
|
21
|
-
|
|
22
|
-
margin-right: ${({ gapSize }: IReqoreTagGroup) => `${GAP_FROM_SIZE[gapSize]}px`};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
margin-bottom: ${({ hasBottomMargin }) => (hasBottomMargin ? '5px' : '0px')};
|
|
26
|
-
}
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-wrap: ${({ wrap }: IReqoreTagGroup) => (wrap ? 'wrap' : 'nowrap')};
|
|
20
|
+
gap: ${({ gapSize }: IReqoreTagGroup) => GAP_FROM_SIZE[gapSize]}px;
|
|
27
21
|
`;
|
|
28
22
|
|
|
29
23
|
const ReqoreTagGroup = ({
|
|
@@ -33,13 +27,13 @@ const ReqoreTagGroup = ({
|
|
|
33
27
|
minimal,
|
|
34
28
|
className,
|
|
35
29
|
columns,
|
|
36
|
-
|
|
30
|
+
wrap = true,
|
|
37
31
|
...rest
|
|
38
32
|
}: IReqoreTagGroup) => (
|
|
39
33
|
<StyledTagGroup
|
|
40
34
|
{...rest}
|
|
41
35
|
gapSize={gapSize}
|
|
42
|
-
|
|
36
|
+
wrap={wrap}
|
|
43
37
|
className={`${className || ''} reqore-tag-group`}
|
|
44
38
|
>
|
|
45
39
|
{React.Children.map(children, (child) =>
|
|
@@ -324,7 +324,7 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
324
324
|
? { tooltip: action.tooltip }
|
|
325
325
|
: action.tooltip
|
|
326
326
|
: {})}
|
|
327
|
-
|
|
327
|
+
isReqoreComponent
|
|
328
328
|
>
|
|
329
329
|
<ReqoreIcon icon={action.icon} size={size} />
|
|
330
330
|
</ReqorePopover>
|
|
@@ -341,7 +341,7 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
341
341
|
onClick: onRemoveClick,
|
|
342
342
|
effect: rest.effect,
|
|
343
343
|
}}
|
|
344
|
-
|
|
344
|
+
isReqoreComponent
|
|
345
345
|
content='Remove'
|
|
346
346
|
>
|
|
347
347
|
<ReqoreIcon icon='CloseLine' size={size} />
|
|
@@ -143,6 +143,8 @@ const ReqoreInput = forwardRef<HTMLTextAreaElement, IReqoreTextareaProps>(
|
|
|
143
143
|
|
|
144
144
|
useTooltip(targetRef?.current, tooltip);
|
|
145
145
|
|
|
146
|
+
console.log(fluid);
|
|
147
|
+
|
|
146
148
|
return (
|
|
147
149
|
<StyledTextareaWrapper
|
|
148
150
|
className={`${className || ''} reqore-control-wrapper`}
|
package/src/constants/sizes.ts
CHANGED
package/src/hooks/usePopover.tsx
CHANGED
package/src/index.tsx
CHANGED
|
@@ -42,7 +42,7 @@ export { ReqoreP, ReqoreP as ReqoreParagraph } from './components/Paragraph';
|
|
|
42
42
|
export { default as ReqorePopover } from './components/Popover';
|
|
43
43
|
export { default as ReqoreRadioGroup } from './components/RadioGroup';
|
|
44
44
|
export { default as ReqoreSidebar } from './components/Sidebar';
|
|
45
|
-
export { ReqoreSpacer } from './components/Spacer';
|
|
45
|
+
export { ReqoreHorizontalSpacer, ReqoreSpacer, ReqoreVerticalSpacer } from './components/Spacer';
|
|
46
46
|
export { default as ReqoreTable } from './components/Table';
|
|
47
47
|
export { default as ReqoreTabs } from './components/Tabs';
|
|
48
48
|
export { default as ReqoreTabsContent } from './components/Tabs/content';
|
|
@@ -58,6 +58,13 @@ export default [
|
|
|
58
58
|
minimal: false,
|
|
59
59
|
badge: 0,
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
icon: 'ZcoolLine',
|
|
63
|
+
label: 'Item without fade',
|
|
64
|
+
content:
|
|
65
|
+
'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',
|
|
66
|
+
showContentFade: false,
|
|
67
|
+
},
|
|
61
68
|
{
|
|
62
69
|
icon: 'FolderWarningFill',
|
|
63
70
|
label: 'Expandable item',
|
package/src/mock/multiSelect.ts
CHANGED
|
@@ -19,7 +19,7 @@ const Template: ComponentStory<typeof Checkbox> = (args) => {
|
|
|
19
19
|
<ReqoreCheckbox {...args} label='Read Only' labelPosition='left' readOnly />
|
|
20
20
|
</ReqoreControlGroup>
|
|
21
21
|
<ReqoreControlGroup>
|
|
22
|
-
<ReqoreCheckbox {...args} intent='info' />
|
|
22
|
+
<ReqoreCheckbox {...args} intent='info' checked />
|
|
23
23
|
<ReqoreCheckbox
|
|
24
24
|
{...args}
|
|
25
25
|
label='Label'
|
|
@@ -2,7 +2,7 @@ import { Meta, Story } from '@storybook/react';
|
|
|
2
2
|
import { IReqoreCollectionProps, ReqoreCollection } from '../../components/Collection';
|
|
3
3
|
import { IReqoreColumnsProps } from '../../components/Columns';
|
|
4
4
|
import items from '../../mock/collectionData';
|
|
5
|
-
import {
|
|
5
|
+
import { IntentArg, SizeArg, argManager } from '../utils/args';
|
|
6
6
|
|
|
7
7
|
export interface IColumnsStoryArgs extends IReqoreColumnsProps {
|
|
8
8
|
multipleColumns?: boolean;
|
|
@@ -72,6 +72,7 @@ const Template: Story<IReqoreCollectionProps> = (args) => {
|
|
|
72
72
|
return (
|
|
73
73
|
<ReqoreCollection
|
|
74
74
|
{...args}
|
|
75
|
+
badge={10}
|
|
75
76
|
actions={[{ label: 'Custom action', icon: 'Home7Line' }, { actions: [{ value: 'Test' }] }]}
|
|
76
77
|
/>
|
|
77
78
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
2
|
import { IReqoreControlGroupProps } from '../../components/ControlGroup';
|
|
3
3
|
import ReqoreInput from '../../components/Input';
|
|
4
|
-
import { ReqoreButton, ReqoreControlGroup, ReqoreTag } from '../../index';
|
|
5
|
-
import {
|
|
4
|
+
import { ReqoreButton, ReqoreCheckbox, ReqoreControlGroup, ReqoreTag } from '../../index';
|
|
5
|
+
import { GapSizeArg, MinimalArg, SizeArg, argManager } from '../utils/args';
|
|
6
6
|
|
|
7
7
|
const { createArg } = argManager<IReqoreControlGroupProps>();
|
|
8
8
|
|
|
@@ -36,8 +36,9 @@ export default {
|
|
|
36
36
|
const Template: Story<IReqoreControlGroupProps> = (args: IReqoreControlGroupProps) => {
|
|
37
37
|
return (
|
|
38
38
|
<ReqoreControlGroup {...args}>
|
|
39
|
-
<ReqoreButton>Button</ReqoreButton>
|
|
39
|
+
<ReqoreButton icon='PictureInPictureLine'>Button</ReqoreButton>
|
|
40
40
|
<ReqoreButton
|
|
41
|
+
icon='PictureInPictureLine'
|
|
41
42
|
flat={false}
|
|
42
43
|
effect={{ gradient: { colors: { 0: 'success', 100: 'info:darken:1' } } }}
|
|
43
44
|
>
|
|
@@ -45,11 +46,25 @@ const Template: Story<IReqoreControlGroupProps> = (args: IReqoreControlGroupProp
|
|
|
45
46
|
</ReqoreButton>
|
|
46
47
|
<ReqoreButton maxWidth='300px'>Button with max width</ReqoreButton>
|
|
47
48
|
<ReqoreTag label='A wild tag appears!' color='main:lighten:2' />
|
|
49
|
+
<ReqoreCheckbox
|
|
50
|
+
asSwitch
|
|
51
|
+
label='Switchy switch'
|
|
52
|
+
margin='both'
|
|
53
|
+
intent='warning'
|
|
54
|
+
checkedIcon='CheckFill'
|
|
55
|
+
checked
|
|
56
|
+
uncheckedIcon='CheckboxBlankLine'
|
|
57
|
+
/>
|
|
48
58
|
<ReqoreInput icon='4KFill' value='Hello' />
|
|
49
59
|
<ReqoreButton disabled fixed>
|
|
50
60
|
Disabled & Fixed
|
|
51
61
|
</ReqoreButton>
|
|
62
|
+
<ReqoreCheckbox checked margin='both'>
|
|
63
|
+
Checkbox
|
|
64
|
+
</ReqoreCheckbox>
|
|
65
|
+
|
|
52
66
|
<ReqoreButton minimal>Minimal</ReqoreButton>
|
|
67
|
+
<ReqoreTag label='smol tag' size='small' />
|
|
53
68
|
</ReqoreControlGroup>
|
|
54
69
|
);
|
|
55
70
|
};
|
|
@@ -79,3 +94,8 @@ export const BigGapSize = Template.bind({});
|
|
|
79
94
|
BigGapSize.args = {
|
|
80
95
|
gapSize: 'big',
|
|
81
96
|
};
|
|
97
|
+
|
|
98
|
+
export const Wrap = Template.bind({});
|
|
99
|
+
Wrap.args = {
|
|
100
|
+
wrap: true,
|
|
101
|
+
};
|