@qoretechnologies/reqore 0.29.8 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/collection.test.tsx +1 -1
- package/__tests__/{control_group.text.tsx → control_group.test.tsx} +4 -2
- package/__tests__/panel.test.tsx +22 -24
- package/__tests__/popover.test.tsx +24 -2
- package/__tests__/tabs.test.tsx +32 -0
- package/dist/components/Button/index.js +6 -6
- package/dist/components/Button/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 -44
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +2 -3
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +8 -4
- 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 +7 -4
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +118 -22
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +6 -4
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +1 -1
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +3 -5
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +10 -6
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.js +2 -2
- 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 +5 -3
- 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 +10 -10
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +6 -3
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +64 -32
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Spacer/index.d.ts +2 -0
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spacer/index.js +29 -7
- package/dist/components/Spacer/index.js.map +1 -1
- package/dist/components/Tabs/content.d.ts +3 -1
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/content.js +8 -3
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +4 -1
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +12 -4
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +1 -0
- 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 +3 -2
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/index.d.ts +3 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +10 -2
- 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.js +7 -7
- package/dist/containers/PopoverProvider.js +3 -3
- package/dist/containers/PopoverProvider.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +1 -0
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +7 -0
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +1 -0
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +4 -2
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/types/global.d.ts +13 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +2 -2
- package/src/components/Collection/index.tsx +29 -39
- package/src/components/Collection/item.tsx +14 -6
- package/src/components/Columns/column.tsx +1 -0
- package/src/components/ControlGroup/index.tsx +390 -227
- package/src/components/Drawer/index.tsx +6 -4
- package/src/components/Effect/index.tsx +1 -0
- package/src/components/Icon/index.tsx +78 -62
- package/src/components/Input/index.tsx +1 -1
- package/src/components/InternalPopover/index.tsx +127 -123
- package/src/components/MultiSelect/index.tsx +180 -188
- package/src/components/Panel/index.tsx +171 -77
- package/src/components/Spacer/index.tsx +63 -14
- package/src/components/Tabs/content.tsx +11 -3
- package/src/components/Tabs/index.tsx +14 -3
- package/src/components/Tabs/item.tsx +24 -1
- package/src/components/Tabs/list.tsx +3 -0
- package/src/components/Tag/index.tsx +30 -23
- package/src/components/Tree/index.tsx +1 -1
- package/src/constants/animations.ts +1 -1
- package/src/constants/sizes.ts +7 -7
- package/src/containers/PopoverProvider.tsx +3 -3
- package/src/containers/ReqoreProvider.tsx +1 -0
- package/src/containers/UIProvider.tsx +7 -0
- package/src/context/ReqoreContext.tsx +1 -0
- package/src/hooks/usePopover.tsx +4 -2
- package/src/mock/collectionData.tsx +21 -1
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +68 -6
- package/src/stories/Icon/Icon.stories.tsx +1 -0
- package/src/stories/Input/Input.stories.tsx +2 -1
- package/src/stories/Panel/Panel.stories.tsx +83 -2
- package/src/stories/Popover/Popover.stories.tsx +5 -5
- package/src/stories/Tabs/Tabs.stories.tsx +30 -14
- package/src/stories/Tag/Tag.stories.tsx +12 -2
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
|
@@ -18,6 +18,7 @@ export interface IReqoreTabListItemProps extends IReqoreTabsListItem, IWithReqor
|
|
|
18
18
|
wrapTabNames?: boolean;
|
|
19
19
|
fill?: boolean;
|
|
20
20
|
className?: string;
|
|
21
|
+
padded?: boolean;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export interface IReqoreTabListItemStyle extends IReqoreTabListItemProps {
|
|
@@ -27,7 +28,7 @@ export interface IReqoreTabListItemStyle extends IReqoreTabListItemProps {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
30
|
-
${({ disabled, vertical, size, fill }: IReqoreTabListItemStyle) => {
|
|
31
|
+
${({ disabled, vertical, size, fill, padded }: IReqoreTabListItemStyle) => {
|
|
31
32
|
return css`
|
|
32
33
|
display: flex;
|
|
33
34
|
flex-shrink: 0;
|
|
@@ -48,6 +49,16 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
|
48
49
|
border-top-right-radius: 0 !important;
|
|
49
50
|
border-bottom-right-radius: 0 !important;
|
|
50
51
|
}
|
|
52
|
+
|
|
53
|
+
${padded === false &&
|
|
54
|
+
css`
|
|
55
|
+
&:first-child {
|
|
56
|
+
padding-top: 0;
|
|
57
|
+
}
|
|
58
|
+
&:last-child {
|
|
59
|
+
padding-bottom: 0;
|
|
60
|
+
}
|
|
61
|
+
`}
|
|
51
62
|
`
|
|
52
63
|
: css`
|
|
53
64
|
${StyledButton} {
|
|
@@ -59,6 +70,16 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
|
59
70
|
${StyledButton}:last-child {
|
|
60
71
|
border-bottom-right-radius: 0 !important;
|
|
61
72
|
}
|
|
73
|
+
|
|
74
|
+
${padded === false &&
|
|
75
|
+
css`
|
|
76
|
+
&:first-child {
|
|
77
|
+
padding-left: 0;
|
|
78
|
+
}
|
|
79
|
+
&:last-child {
|
|
80
|
+
padding-right: 0;
|
|
81
|
+
}
|
|
82
|
+
`}
|
|
62
83
|
`}
|
|
63
84
|
|
|
64
85
|
${fill &&
|
|
@@ -109,6 +130,7 @@ const ReqoreTabsListItem = memo(
|
|
|
109
130
|
flat = true,
|
|
110
131
|
wrapTabNames,
|
|
111
132
|
id,
|
|
133
|
+
padded,
|
|
112
134
|
...rest
|
|
113
135
|
}: IReqoreTabListItemProps,
|
|
114
136
|
ref
|
|
@@ -129,6 +151,7 @@ const ReqoreTabsListItem = memo(
|
|
|
129
151
|
vertical={vertical}
|
|
130
152
|
theme={theme}
|
|
131
153
|
fill={fill}
|
|
154
|
+
padded={padded}
|
|
132
155
|
>
|
|
133
156
|
{label || icon ? (
|
|
134
157
|
<ReqoreControlGroup stack size={size} fluid={fill || vertical}>
|
|
@@ -162,6 +162,7 @@ const ReqoreTabsList = ({
|
|
|
162
162
|
flat,
|
|
163
163
|
size,
|
|
164
164
|
intent,
|
|
165
|
+
padded,
|
|
165
166
|
...rest
|
|
166
167
|
}: IReqoreTabsListProps) => {
|
|
167
168
|
const [ref, { width }] = useMeasure();
|
|
@@ -211,6 +212,7 @@ const ReqoreTabsList = ({
|
|
|
211
212
|
vertical,
|
|
212
213
|
flat,
|
|
213
214
|
size,
|
|
215
|
+
padded,
|
|
214
216
|
className: 'reqore-tabs-list-item-menu',
|
|
215
217
|
} as IReqoreTabListItemProps
|
|
216
218
|
}
|
|
@@ -279,6 +281,7 @@ const ReqoreTabsList = ({
|
|
|
279
281
|
fill={fill}
|
|
280
282
|
size={size}
|
|
281
283
|
flat={flat}
|
|
284
|
+
padded={padded}
|
|
282
285
|
activeIntent={activeTabIntent}
|
|
283
286
|
wrapTabNames={wrapTabNames}
|
|
284
287
|
{...item}
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
IReqoreDisabled,
|
|
27
27
|
IReqoreIntent,
|
|
28
28
|
IWithReqoreEffect,
|
|
29
|
+
IWithReqoreFluid,
|
|
29
30
|
IWithReqoreMinimal,
|
|
30
31
|
IWithReqoreTooltip,
|
|
31
32
|
} from '../../types/global';
|
|
@@ -35,6 +36,7 @@ import ReqoreIcon from '../Icon';
|
|
|
35
36
|
|
|
36
37
|
export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
|
|
37
38
|
icon: IReqoreIconName;
|
|
39
|
+
show?: boolean;
|
|
38
40
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -43,7 +45,8 @@ export interface IReqoreTagProps
|
|
|
43
45
|
IWithReqoreTooltip,
|
|
44
46
|
IReqoreDisabled,
|
|
45
47
|
IWithReqoreEffect,
|
|
46
|
-
IWithReqoreMinimal
|
|
48
|
+
IWithReqoreMinimal,
|
|
49
|
+
IWithReqoreFluid {
|
|
47
50
|
size?: TSizes;
|
|
48
51
|
label?: string | number;
|
|
49
52
|
labelKey?: string | number;
|
|
@@ -81,6 +84,8 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
81
84
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
82
85
|
|
|
83
86
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
87
|
+
width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
88
|
+
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
84
89
|
border-radius: ${({ asBadge, size }) => (asBadge ? 18 : RADIUS_FROM_SIZE[size])}px;
|
|
85
90
|
width: ${({ width }) => width || undefined};
|
|
86
91
|
transition: all 0.2s ease-out;
|
|
@@ -331,28 +336,30 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
331
336
|
</StyledTagContentWrapper>
|
|
332
337
|
) : null}
|
|
333
338
|
{_size(actions)
|
|
334
|
-
? actions
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
339
|
+
? actions
|
|
340
|
+
.filter((action) => action.show !== false)
|
|
341
|
+
.map((action, index) => (
|
|
342
|
+
<React.Fragment key={index}>
|
|
343
|
+
<ReqorePopover
|
|
344
|
+
component={StyledButtonWrapper}
|
|
345
|
+
componentProps={{
|
|
346
|
+
size,
|
|
347
|
+
color: getCustomColor(action.intent),
|
|
348
|
+
className: 'reqore-tag-action',
|
|
349
|
+
onClick: action.onClick,
|
|
350
|
+
effect: rest.effect,
|
|
351
|
+
}}
|
|
352
|
+
{...(action.tooltip
|
|
353
|
+
? typeof action.tooltip === 'string'
|
|
354
|
+
? { tooltip: action.tooltip }
|
|
355
|
+
: action.tooltip
|
|
356
|
+
: {})}
|
|
357
|
+
isReqoreComponent
|
|
358
|
+
>
|
|
359
|
+
<ReqoreIcon icon={action.icon} size={size} />
|
|
360
|
+
</ReqorePopover>
|
|
361
|
+
</React.Fragment>
|
|
362
|
+
))
|
|
356
363
|
: null}
|
|
357
364
|
{onRemoveClick && !rest.disabled ? (
|
|
358
365
|
<ReqorePopover
|
|
@@ -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
|
package/src/constants/sizes.ts
CHANGED
|
@@ -37,19 +37,19 @@ export const HEADER_SIZE_TO_NUMBER = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const SIZE_TO_PX = {
|
|
40
|
-
tiny:
|
|
41
|
-
small:
|
|
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:
|
|
49
|
-
small:
|
|
50
|
-
normal:
|
|
51
|
-
big:
|
|
52
|
-
huge:
|
|
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 = {
|
|
@@ -66,21 +66,21 @@ const PopoverProvider: React.FC<IReqorePopoverProviderProps> = ({ children, uiSc
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
useEffect(() => {
|
|
69
|
-
document.addEventListener('
|
|
69
|
+
document.addEventListener('mousedown', handleClick);
|
|
70
70
|
|
|
71
71
|
if (closePopoversOnEscPress) {
|
|
72
72
|
document.addEventListener('keydown', handleKeyDown);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return () => {
|
|
76
|
-
document.removeEventListener('
|
|
76
|
+
document.removeEventListener('mousedown', handleClick);
|
|
77
77
|
document.removeEventListener('keydown', handleKeyDown);
|
|
78
78
|
};
|
|
79
79
|
}, [popovers]);
|
|
80
80
|
|
|
81
81
|
useEffect(() => {
|
|
82
82
|
if (!size(popovers)) {
|
|
83
|
-
document.removeEventListener('
|
|
83
|
+
document.removeEventListener('mousedown', handleClick);
|
|
84
84
|
document.removeEventListener('keydown', handleKeyDown);
|
|
85
85
|
}
|
|
86
86
|
}, [popovers]);
|
|
@@ -122,6 +122,7 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, options = {}
|
|
|
122
122
|
isMobileOrTablet,
|
|
123
123
|
getAndIncreaseZIndex,
|
|
124
124
|
animations: options.animations || { buttons: true, dialogs: true },
|
|
125
|
+
tooltips: options.tooltips || { delay: 0 },
|
|
125
126
|
closePopoversOnEscPress:
|
|
126
127
|
'closePopoversOnEscPress' in options ? options.closePopoversOnEscPress : true,
|
|
127
128
|
}}
|
|
@@ -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,6 +12,7 @@ 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;
|
|
16
17
|
}
|
|
17
18
|
|
package/src/hooks/usePopover.tsx
CHANGED
|
@@ -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',
|
|
@@ -77,6 +78,7 @@ const usePopover = ({
|
|
|
77
78
|
}: IPopoverOptions): IPopoverControls => {
|
|
78
79
|
const { addPopover, removePopover, updatePopover, popovers, isPopoverOpen } =
|
|
79
80
|
useContext(PopoverContext);
|
|
81
|
+
const { tooltips } = useReqore();
|
|
80
82
|
const { current }: MutableRefObject<string> = useRef(shortid.generate());
|
|
81
83
|
let { current: timeout }: MutableRefObject<any> = useRef(0);
|
|
82
84
|
|
|
@@ -112,10 +114,10 @@ const usePopover = ({
|
|
|
112
114
|
_removePopover?.();
|
|
113
115
|
}
|
|
114
116
|
} else if (show) {
|
|
115
|
-
if (delay) {
|
|
117
|
+
if (delay || tooltips.delay) {
|
|
116
118
|
timeout = setTimeout(() => {
|
|
117
119
|
openPopover();
|
|
118
|
-
}, delay);
|
|
120
|
+
}, delay || tooltips.delay);
|
|
119
121
|
} else {
|
|
120
122
|
openPopover();
|
|
121
123
|
}
|
|
@@ -104,6 +104,22 @@ export default [
|
|
|
104
104
|
weight: 'thin',
|
|
105
105
|
spaced: 2,
|
|
106
106
|
},
|
|
107
|
+
expandedActions: [
|
|
108
|
+
{
|
|
109
|
+
label: 'Action 1',
|
|
110
|
+
id: 'action1',
|
|
111
|
+
icon: 'CapsuleFill',
|
|
112
|
+
onClick: () => alert('Action 1 clicked'),
|
|
113
|
+
position: 'left',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: 'Action 2',
|
|
117
|
+
id: 'action2',
|
|
118
|
+
icon: 'CapsuleFill',
|
|
119
|
+
onClick: () => alert('Action 2 clicked'),
|
|
120
|
+
position: 'right',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
107
123
|
expandedContent: (
|
|
108
124
|
<>
|
|
109
125
|
<ReqoreMessage intent='info'>Hello I am a custom content</ReqoreMessage>
|
|
@@ -191,6 +207,9 @@ export default [
|
|
|
191
207
|
},
|
|
192
208
|
{
|
|
193
209
|
label: 'I have intent!',
|
|
210
|
+
transparent: true,
|
|
211
|
+
minimal: false,
|
|
212
|
+
flat: false,
|
|
194
213
|
content: (
|
|
195
214
|
<ReqoreP>
|
|
196
215
|
'Well would you look at that. Lorem ipsum dolor{' '}
|
|
@@ -242,13 +261,14 @@ export default [
|
|
|
242
261
|
{
|
|
243
262
|
label: 'I have actions',
|
|
244
263
|
content:
|
|
245
|
-
'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',
|
|
264
|
+
'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',
|
|
246
265
|
actions: [
|
|
247
266
|
{
|
|
248
267
|
label: 'Action 1',
|
|
249
268
|
id: 'action1',
|
|
250
269
|
icon: 'CapsuleFill',
|
|
251
270
|
onClick: () => alert('Action 1 clicked'),
|
|
271
|
+
show: false,
|
|
252
272
|
},
|
|
253
273
|
{
|
|
254
274
|
label: 'Action 2',
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ReqoreTag,
|
|
10
10
|
ReqoreVerticalSpacer,
|
|
11
11
|
} from '../../index';
|
|
12
|
-
import { GapSizeArg, MinimalArg, SizeArg
|
|
12
|
+
import { argManager, GapSizeArg, MinimalArg, SizeArg } from '../utils/args';
|
|
13
13
|
|
|
14
14
|
const { createArg } = argManager<IReqoreControlGroupProps>();
|
|
15
15
|
|
|
@@ -47,14 +47,49 @@ export default {
|
|
|
47
47
|
} as Meta<IReqoreControlGroupProps>;
|
|
48
48
|
|
|
49
49
|
const Template: Story<IReqoreControlGroupProps> = (args: IReqoreControlGroupProps) => {
|
|
50
|
+
if (args.responsive) {
|
|
51
|
+
return (
|
|
52
|
+
<div style={{ width: 600 }}>
|
|
53
|
+
<ReqoreControlGroup {...args} wrap={false}>
|
|
54
|
+
<ReqoreButton icon='PictureInPictureLine'>Button</ReqoreButton>
|
|
55
|
+
<ReqoreControlGroup stack>
|
|
56
|
+
<ReqoreTag label='A wild tag appears!' color='main:lighten:2' />
|
|
57
|
+
</ReqoreControlGroup>
|
|
58
|
+
<ReqoreControlGroup stack>
|
|
59
|
+
<ReqoreButton maxWidth='300px'>Button with max width</ReqoreButton>
|
|
60
|
+
<ReqoreTag label='A wild tag appears!' color='main:lighten:2' />
|
|
61
|
+
</ReqoreControlGroup>
|
|
62
|
+
<ReqoreControlGroup stack>
|
|
63
|
+
<ReqoreControlGroup>
|
|
64
|
+
<ReqoreButton customTheme={{ main: '#00e3e8' }}>Level 2 deep</ReqoreButton>
|
|
65
|
+
<ReqoreControlGroup fixed>
|
|
66
|
+
<ReqoreButton disabled fixed id='test'>
|
|
67
|
+
Level 3 deep and fixed
|
|
68
|
+
</ReqoreButton>
|
|
69
|
+
</ReqoreControlGroup>
|
|
70
|
+
</ReqoreControlGroup>
|
|
71
|
+
<ReqoreButton intent='danger'>Level 1 deep</ReqoreButton>
|
|
72
|
+
<ReqoreCheckbox checked margin='both' label='Level 1 deep' />
|
|
73
|
+
</ReqoreControlGroup>
|
|
74
|
+
<ReqoreButton icon='PictureInPictureLine'>Button</ReqoreButton>
|
|
75
|
+
<ReqoreButton maxWidth='300px'>Button with max width</ReqoreButton>
|
|
76
|
+
</ReqoreControlGroup>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
50
81
|
return (
|
|
51
82
|
<>
|
|
52
83
|
<ReqoreControlGroup {...args}>
|
|
53
84
|
<ReqoreButton icon='PictureInPictureLine'>Button</ReqoreButton>
|
|
85
|
+
<ReqoreButton icon='PictureInPictureLine' fluid>
|
|
86
|
+
Fluid Button
|
|
87
|
+
</ReqoreButton>
|
|
54
88
|
<ReqoreButton
|
|
55
89
|
icon='PictureInPictureLine'
|
|
56
90
|
flat={false}
|
|
57
91
|
effect={{ gradient: { colors: { 0: 'success', 100: 'info:darken:1' } } }}
|
|
92
|
+
description="With a description, it's a bit longer than the button itself"
|
|
58
93
|
>
|
|
59
94
|
Non flat Button
|
|
60
95
|
</ReqoreButton>
|
|
@@ -71,13 +106,13 @@ const Template: Story<IReqoreControlGroupProps> = (args: IReqoreControlGroupProp
|
|
|
71
106
|
checked
|
|
72
107
|
uncheckedIcon='CheckboxBlankLine'
|
|
73
108
|
/>
|
|
74
|
-
<ReqoreInput icon='4KFill' value='Hello' />
|
|
109
|
+
<ReqoreInput icon='4KFill' value='Hello I am fluid' fluid />
|
|
75
110
|
<ReqoreControlGroup stack>
|
|
76
111
|
<ReqoreControlGroup>
|
|
77
112
|
<ReqoreButton customTheme={{ main: '#00e3e8' }}>Level 2 deep</ReqoreButton>
|
|
78
|
-
<ReqoreControlGroup>
|
|
113
|
+
<ReqoreControlGroup fixed>
|
|
79
114
|
<ReqoreButton disabled fixed id='test'>
|
|
80
|
-
Level 3 deep
|
|
115
|
+
Level 3 deep and fixed
|
|
81
116
|
</ReqoreButton>
|
|
82
117
|
</ReqoreControlGroup>
|
|
83
118
|
</ReqoreControlGroup>
|
|
@@ -187,6 +222,11 @@ Minimal.args = {
|
|
|
187
222
|
minimal: true,
|
|
188
223
|
};
|
|
189
224
|
|
|
225
|
+
export const Fluid = Template.bind({});
|
|
226
|
+
Fluid.args = {
|
|
227
|
+
fluid: true,
|
|
228
|
+
};
|
|
229
|
+
|
|
190
230
|
export const NotFlat = Template.bind({});
|
|
191
231
|
NotFlat.args = {
|
|
192
232
|
flat: false,
|
|
@@ -197,8 +237,14 @@ Vertical.args = {
|
|
|
197
237
|
vertical: true,
|
|
198
238
|
};
|
|
199
239
|
|
|
200
|
-
export const
|
|
201
|
-
|
|
240
|
+
export const VerticalFluid = Template.bind({});
|
|
241
|
+
VerticalFluid.args = {
|
|
242
|
+
vertical: true,
|
|
243
|
+
fluid: true,
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export const VerticalStackedFluid = Template.bind({});
|
|
247
|
+
VerticalStackedFluid.args = {
|
|
202
248
|
vertical: true,
|
|
203
249
|
stack: true,
|
|
204
250
|
fluid: true,
|
|
@@ -218,3 +264,19 @@ export const NoWrap = Template.bind({});
|
|
|
218
264
|
NoWrap.args = {
|
|
219
265
|
wrap: false,
|
|
220
266
|
};
|
|
267
|
+
|
|
268
|
+
export const HorizontalAlign = Template.bind({});
|
|
269
|
+
HorizontalAlign.args = {
|
|
270
|
+
vertical: true,
|
|
271
|
+
horizontalAlign: 'center',
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export const VerticalAlign = Template.bind({});
|
|
275
|
+
VerticalAlign.args = {
|
|
276
|
+
verticalAlign: 'flex-end',
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export const Responsive = Template.bind({});
|
|
280
|
+
Responsive.args = {
|
|
281
|
+
responsive: true,
|
|
282
|
+
};
|
|
@@ -2,13 +2,14 @@ import { Meta, Story } from '@storybook/react/types-6-0';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import ReqoreInput, { IReqoreInputProps } from '../../components/Input';
|
|
4
4
|
import { ReqoreControlGroup } from '../../index';
|
|
5
|
-
import { FlatArg, IconArg, MinimalArg } from '../utils/args';
|
|
5
|
+
import { FlatArg, IconArg, MinimalArg, SizeArg } from '../utils/args';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: 'Components/Input',
|
|
9
9
|
argTypes: {
|
|
10
10
|
...MinimalArg,
|
|
11
11
|
...FlatArg,
|
|
12
|
+
...SizeArg,
|
|
12
13
|
...IconArg('icon', 'Icon', 'SearchLine'),
|
|
13
14
|
},
|
|
14
15
|
} as Meta<IReqoreInputProps>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
2
|
import { noop } from 'lodash';
|
|
3
3
|
import ReqoreInput, { IReqoreInputProps } from '../../components/Input';
|
|
4
|
-
import { IReqorePanelProps, ReqorePanel } from '../../components/Panel';
|
|
4
|
+
import { IReqorePanelAction, IReqorePanelProps, ReqorePanel } from '../../components/Panel';
|
|
5
|
+
import { ReqoreVerticalSpacer } from '../../components/Spacer';
|
|
5
6
|
import { FlatArg, IconArg, IntentArg, argManager } from '../utils/args';
|
|
6
7
|
|
|
7
8
|
const { createArg } = argManager<IReqorePanelProps>();
|
|
@@ -64,6 +65,62 @@ export default {
|
|
|
64
65
|
} as Meta<IReqorePanelProps>;
|
|
65
66
|
|
|
66
67
|
const Template: Story<IReqorePanelProps> = (args: IReqorePanelProps) => {
|
|
68
|
+
if (args.fluid) {
|
|
69
|
+
const actions: IReqorePanelAction[] = [
|
|
70
|
+
{
|
|
71
|
+
icon: 'GiftFill',
|
|
72
|
+
label: 'Visible',
|
|
73
|
+
responsive: false,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: 'Hidden when small',
|
|
77
|
+
icon: 'EyeCloseLine',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: 'Hidden when small',
|
|
81
|
+
icon: 'EyeCloseLine',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: 'Hidden when small',
|
|
85
|
+
icon: 'EyeCloseLine',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: 'Hidden when small',
|
|
89
|
+
icon: 'EyeCloseLine',
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<>
|
|
95
|
+
<ReqorePanel
|
|
96
|
+
{...args}
|
|
97
|
+
badge='Fluid'
|
|
98
|
+
actions={actions}
|
|
99
|
+
bottomActions={[
|
|
100
|
+
...actions,
|
|
101
|
+
...actions.map((action) => ({ ...action, position: 'right' })),
|
|
102
|
+
]}
|
|
103
|
+
>
|
|
104
|
+
This is a fluid panel
|
|
105
|
+
</ReqorePanel>
|
|
106
|
+
<ReqoreVerticalSpacer height={10} />
|
|
107
|
+
<ReqorePanel
|
|
108
|
+
{...args}
|
|
109
|
+
style={{ width: 400 }}
|
|
110
|
+
fluid={false}
|
|
111
|
+
badge='Not Fluid'
|
|
112
|
+
actions={actions}
|
|
113
|
+
bottomActions={[
|
|
114
|
+
...actions,
|
|
115
|
+
...actions.map((action) => ({ ...action, position: 'right' })),
|
|
116
|
+
]}
|
|
117
|
+
>
|
|
118
|
+
This is not a fluid panel
|
|
119
|
+
</ReqorePanel>
|
|
120
|
+
</>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
67
124
|
return (
|
|
68
125
|
<ReqorePanel
|
|
69
126
|
{...args}
|
|
@@ -85,7 +142,12 @@ const Template: Story<IReqorePanelProps> = (args: IReqorePanelProps) => {
|
|
|
85
142
|
},
|
|
86
143
|
]}
|
|
87
144
|
actions={[
|
|
88
|
-
{
|
|
145
|
+
{
|
|
146
|
+
label: 'Non responsive',
|
|
147
|
+
icon: '24HoursFill',
|
|
148
|
+
customTheme: { main: '#eb0e8c' },
|
|
149
|
+
responsive: false,
|
|
150
|
+
},
|
|
89
151
|
[
|
|
90
152
|
{ label: 'Stacked Action 1', icon: 'BallPenLine', intent: 'warning' },
|
|
91
153
|
{ icon: 'CopperCoinFill', intent: 'danger' },
|
|
@@ -167,12 +229,31 @@ Transparent.args = {
|
|
|
167
229
|
transparent: true,
|
|
168
230
|
};
|
|
169
231
|
|
|
232
|
+
export const Intent: Story<IReqorePanelProps> = Template.bind({});
|
|
233
|
+
Intent.args = {
|
|
234
|
+
intent: 'success',
|
|
235
|
+
iconColor: 'success:lighten:2',
|
|
236
|
+
transparent: true,
|
|
237
|
+
flat: true,
|
|
238
|
+
};
|
|
239
|
+
|
|
170
240
|
export const Minimal: Story<IReqorePanelProps> = Template.bind({});
|
|
171
241
|
Minimal.args = {
|
|
172
242
|
minimal: true,
|
|
173
243
|
flat: true,
|
|
174
244
|
};
|
|
175
245
|
|
|
246
|
+
export const TransparentFlat: Story<IReqorePanelProps> = Template.bind({});
|
|
247
|
+
TransparentFlat.args = {
|
|
248
|
+
transparent: true,
|
|
249
|
+
flat: true,
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
export const Fluid: Story<IReqorePanelProps> = Template.bind({});
|
|
253
|
+
Fluid.args = {
|
|
254
|
+
fluid: true,
|
|
255
|
+
};
|
|
256
|
+
|
|
176
257
|
export const WithEffect: Story<IReqorePanelProps> = Template.bind({});
|
|
177
258
|
WithEffect.args = {
|
|
178
259
|
iconColor: 'info:lighten:2',
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
ReqoreMessage,
|
|
9
9
|
ReqorePanel,
|
|
10
10
|
ReqorePopover,
|
|
11
|
-
ReqoreSpacer
|
|
11
|
+
ReqoreSpacer
|
|
12
12
|
} from '../../index';
|
|
13
|
-
import {
|
|
13
|
+
import { argManager, FlatArg } from '../utils/args';
|
|
14
14
|
|
|
15
15
|
const { createArg } = argManager<IReqorePopoverProps>();
|
|
16
16
|
|
|
@@ -56,7 +56,7 @@ export default {
|
|
|
56
56
|
|
|
57
57
|
const HoverButton = (args: any) => {
|
|
58
58
|
return (
|
|
59
|
-
<ReqorePopover component={ReqoreButton} isReqoreComponent {...args}>
|
|
59
|
+
<ReqorePopover component={ReqoreButton} isReqoreComponent {...args} fixed>
|
|
60
60
|
Hover popover
|
|
61
61
|
</ReqorePopover>
|
|
62
62
|
);
|
|
@@ -107,7 +107,7 @@ const HoverStayButton = (args: any) => {
|
|
|
107
107
|
const Template: Story<IReqorePopoverProps> = (args: IReqorePopoverProps) => {
|
|
108
108
|
return (
|
|
109
109
|
<>
|
|
110
|
-
<ReqoreControlGroup vertical gapSize='huge'>
|
|
110
|
+
<ReqoreControlGroup vertical gapSize='huge' horizontalAlign='flex-start'>
|
|
111
111
|
<HoverButton {...args} />
|
|
112
112
|
<ClickButton {...args} />
|
|
113
113
|
<DelayButton {...args} />
|
|
@@ -128,7 +128,7 @@ const Template: Story<IReqorePopoverProps> = (args: IReqorePopoverProps) => {
|
|
|
128
128
|
Full popover
|
|
129
129
|
</ReqorePopover>
|
|
130
130
|
<ReqoreControlGroup>
|
|
131
|
-
<ReqoreSpacer width={
|
|
131
|
+
<ReqoreSpacer width={190} />
|
|
132
132
|
<ReqorePopover
|
|
133
133
|
{...args}
|
|
134
134
|
component={ReqoreButton}
|