@qoretechnologies/reqore 0.26.1 → 0.27.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.
- package/__tests__/panel.test.tsx +3 -3
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/index.js +1 -1
- package/dist/components/Breadcrumbs/index.js.map +1 -1
- package/dist/components/Button/index.d.ts +7 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +45 -20
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +9 -1
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.js +1 -1
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +3 -1
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Effect/index.d.ts +10 -2
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +20 -11
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Header/index.d.ts +2 -1
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +6 -5
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Menu/divider.d.ts +2 -1
- package/dist/components/Menu/divider.d.ts.map +1 -1
- package/dist/components/Menu/divider.js +4 -3
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Menu/index.d.ts +1 -0
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +3 -2
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +2 -2
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Panel/index.d.ts +2 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +22 -12
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spacer/index.js +1 -1
- package/dist/components/Spacer/index.js.map +1 -1
- package/dist/components/Tabs/index.js +2 -2
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +2 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +2 -2
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +1 -1
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +3 -3
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/constants/animations.d.ts +4 -0
- package/dist/constants/animations.d.ts.map +1 -1
- package/dist/constants/animations.js +5 -1
- package/dist/constants/animations.js.map +1 -1
- package/dist/constants/sizes.d.ts +21 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +22 -1
- package/dist/constants/sizes.js.map +1 -1
- package/dist/containers/ReqoreProvider.js +1 -1
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +1 -0
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js +2 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.d.ts +1 -0
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +11 -1
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/utils.d.ts +2 -0
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +11 -1
- package/dist/helpers/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Breadcrumbs/index.tsx +1 -0
- package/src/components/Button/index.tsx +156 -86
- package/src/components/Collection/index.tsx +10 -11
- package/src/components/Collection/item.tsx +1 -1
- package/src/components/Drawer/index.tsx +5 -3
- package/src/components/Effect/index.tsx +34 -3
- package/src/components/Header/index.tsx +16 -11
- package/src/components/Menu/divider.tsx +17 -9
- package/src/components/Menu/index.tsx +13 -1
- package/src/components/Menu/item.tsx +3 -2
- package/src/components/Panel/index.tsx +36 -9
- package/src/components/Spacer/index.tsx +1 -0
- package/src/components/Tabs/index.tsx +1 -1
- package/src/components/Tabs/item.tsx +7 -3
- package/src/components/Tabs/list.tsx +1 -0
- package/src/components/Tag/index.tsx +3 -2
- package/src/constants/animations.ts +5 -0
- package/src/constants/sizes.ts +24 -0
- package/src/containers/ReqoreProvider.tsx +1 -1
- package/src/containers/UIProvider.tsx +1 -0
- package/src/context/ReqoreContext.tsx +1 -0
- package/src/helpers/colors.ts +15 -0
- package/src/helpers/utils.ts +10 -0
- package/src/mock/collectionData.tsx +2 -2
- package/src/stories/Button/Button.stories.tsx +69 -1
- package/src/stories/Dropdown/Dropdown.stories.tsx +2 -0
- package/src/stories/Menu/Menu.stories.tsx +36 -8
- package/src/stories/Panel/Panel.stories.tsx +8 -5
- package/src/stories/Tabs/Tabs.stories.tsx +10 -5
- package/src/stories/Tag/Tag.stories.tsx +42 -4
- package/tests.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { size } from 'lodash';
|
|
2
2
|
import { rgba } from 'polished';
|
|
3
|
-
import {
|
|
3
|
+
import { ReactElement, forwardRef, useCallback, useMemo, useState } from 'react';
|
|
4
4
|
import { useUpdateEffect } from 'react-use';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import {
|
|
@@ -40,7 +40,9 @@ export interface IReqorePanelAction extends IReqoreButtonProps, IWithReqoreToolt
|
|
|
40
40
|
label?: string | number;
|
|
41
41
|
onClick?: () => void;
|
|
42
42
|
actions?: IReqoreDropdownItem[];
|
|
43
|
-
|
|
43
|
+
// Custom react element
|
|
44
|
+
as?: React.ElementType;
|
|
45
|
+
props?: any;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export interface IReqorePanelBottomAction extends IReqorePanelAction {
|
|
@@ -175,7 +177,6 @@ export const StyledPanelBottomActions = styled(StyledPanelTitle)`
|
|
|
175
177
|
|
|
176
178
|
export const StyledPanelContent = styled.div<IStyledPanel>`
|
|
177
179
|
display: ${({ isCollapsed }) => (isCollapsed ? 'none' : undefined)};
|
|
178
|
-
min-height: ${({ isCollapsed }) => (isCollapsed ? undefined : '40px')};
|
|
179
180
|
padding: ${({ padded, contentSize, noHorizontalPadding }) =>
|
|
180
181
|
!padded
|
|
181
182
|
? undefined
|
|
@@ -184,7 +185,9 @@ export const StyledPanelContent = styled.div<IStyledPanel>`
|
|
|
184
185
|
: `${TEXT_FROM_SIZE[contentSize]}px`};
|
|
185
186
|
// The padding is not needed when the panel is minimal and has title, since
|
|
186
187
|
// the title already has padding and is transparent
|
|
187
|
-
padding-top: ${({ minimal, hasLabel }) =>
|
|
188
|
+
padding-top: ${({ minimal, hasLabel, padded }) =>
|
|
189
|
+
minimal && hasLabel && padded ? '0px' : undefined};
|
|
190
|
+
padding-bottom: ${({ minimal, padded }) => (minimal && padded ? '10px' : undefined)};
|
|
188
191
|
flex: 1;
|
|
189
192
|
overflow: auto;
|
|
190
193
|
font-size: ${({ contentSize }) => TEXT_FROM_SIZE[contentSize]}px;
|
|
@@ -229,7 +232,7 @@ export const ReqorePanel = forwardRef(
|
|
|
229
232
|
ref
|
|
230
233
|
) => {
|
|
231
234
|
const [_isCollapsed, setIsCollapsed] = useState(isCollapsed || false);
|
|
232
|
-
const theme = useReqoreTheme('main', customTheme
|
|
235
|
+
const theme = useReqoreTheme('main', customTheme);
|
|
233
236
|
const { targetRef } = useCombinedRefs(ref);
|
|
234
237
|
|
|
235
238
|
useTooltip(targetRef.current, tooltip);
|
|
@@ -279,7 +282,8 @@ export const ReqorePanel = forwardRef(
|
|
|
279
282
|
label,
|
|
280
283
|
intent,
|
|
281
284
|
className,
|
|
282
|
-
|
|
285
|
+
as: CustomElement,
|
|
286
|
+
props,
|
|
283
287
|
...rest
|
|
284
288
|
}: IReqorePanelAction = actionOrActions;
|
|
285
289
|
|
|
@@ -292,14 +296,25 @@ export const ReqorePanel = forwardRef(
|
|
|
292
296
|
items={actions}
|
|
293
297
|
intent={intent}
|
|
294
298
|
className={className}
|
|
299
|
+
customTheme={theme}
|
|
295
300
|
onClick={(e: React.MouseEvent<HTMLButtonElement>) => e.stopPropagation()}
|
|
296
301
|
id={id}
|
|
297
302
|
/>
|
|
298
303
|
);
|
|
299
304
|
}
|
|
300
305
|
|
|
301
|
-
if (
|
|
302
|
-
return
|
|
306
|
+
if (CustomElement) {
|
|
307
|
+
return (
|
|
308
|
+
<CustomElement
|
|
309
|
+
{...props}
|
|
310
|
+
key={index}
|
|
311
|
+
customTheme={theme}
|
|
312
|
+
onClick={(e: React.MouseEvent<any>) => {
|
|
313
|
+
e.stopPropagation();
|
|
314
|
+
props?.onClick?.(e);
|
|
315
|
+
}}
|
|
316
|
+
/>
|
|
317
|
+
);
|
|
303
318
|
}
|
|
304
319
|
|
|
305
320
|
return (
|
|
@@ -345,7 +360,18 @@ export const ReqorePanel = forwardRef(
|
|
|
345
360
|
className={`${className || ''} reqore-panel`}
|
|
346
361
|
interactive={interactive}
|
|
347
362
|
theme={theme}
|
|
348
|
-
effect={
|
|
363
|
+
effect={
|
|
364
|
+
{
|
|
365
|
+
glow: intent
|
|
366
|
+
? {
|
|
367
|
+
color: intent,
|
|
368
|
+
size: 2,
|
|
369
|
+
useBorder: true,
|
|
370
|
+
}
|
|
371
|
+
: undefined,
|
|
372
|
+
...contentEffect,
|
|
373
|
+
} as IReqoreEffect
|
|
374
|
+
}
|
|
349
375
|
>
|
|
350
376
|
{hasTitleBar && (
|
|
351
377
|
<StyledPanelTitle
|
|
@@ -370,6 +396,7 @@ export const ReqorePanel = forwardRef(
|
|
|
370
396
|
{typeof label === 'string' ? (
|
|
371
397
|
<ReqoreHeading
|
|
372
398
|
size={headerSize}
|
|
399
|
+
customTheme={theme}
|
|
373
400
|
effect={{
|
|
374
401
|
noWrap: true,
|
|
375
402
|
...headerEffect,
|
|
@@ -6,10 +6,11 @@ import { IReqoreCustomTheme, IReqoreTheme } from '../../constants/theme';
|
|
|
6
6
|
import { changeLightness } from '../../helpers/colors';
|
|
7
7
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
8
8
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
9
|
+
import { IWithReqoreFlat } from '../../types/global';
|
|
9
10
|
import ReqoreButton from '../Button';
|
|
10
11
|
import ReqoreControlGroup from '../ControlGroup';
|
|
11
12
|
|
|
12
|
-
export interface IReqoreTabListItemProps extends IReqoreTabsListItem {
|
|
13
|
+
export interface IReqoreTabListItemProps extends IReqoreTabsListItem, IWithReqoreFlat {
|
|
13
14
|
active?: boolean;
|
|
14
15
|
vertical?: boolean;
|
|
15
16
|
onCloseClick?: any;
|
|
@@ -95,6 +96,8 @@ const ReqoreTabsListItem = memo(
|
|
|
95
96
|
closeIcon,
|
|
96
97
|
customTheme,
|
|
97
98
|
className,
|
|
99
|
+
flat = true,
|
|
100
|
+
wrapTabNames,
|
|
98
101
|
}: IReqoreTabListItemProps,
|
|
99
102
|
ref
|
|
100
103
|
) => {
|
|
@@ -122,10 +125,11 @@ const ReqoreTabsListItem = memo(
|
|
|
122
125
|
{label || icon ? (
|
|
123
126
|
<ReqoreControlGroup stack size={size} fluid={fill || vertical}>
|
|
124
127
|
<ReqoreButton
|
|
125
|
-
flat={
|
|
128
|
+
flat={active || intent ? false : flat}
|
|
126
129
|
fluid={fill || vertical}
|
|
127
130
|
icon={icon}
|
|
128
131
|
minimal
|
|
132
|
+
wrap={wrapTabNames}
|
|
129
133
|
intent={active ? activeIntent || intent : intent}
|
|
130
134
|
active={active}
|
|
131
135
|
disabled={disabled}
|
|
@@ -139,7 +143,7 @@ const ReqoreTabsListItem = memo(
|
|
|
139
143
|
{onCloseClick && !disabled ? (
|
|
140
144
|
<ReqoreButton
|
|
141
145
|
fixed
|
|
142
|
-
flat={
|
|
146
|
+
flat={active || intent ? false : flat}
|
|
143
147
|
icon={closeIcon || 'CloseLine'}
|
|
144
148
|
intent={active ? activeIntent || intent : intent}
|
|
145
149
|
minimal
|
|
@@ -4,6 +4,7 @@ import React, { forwardRef, useContext } from 'react';
|
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
5
|
import { ReqorePopover } from '../..';
|
|
6
6
|
import {
|
|
7
|
+
BADGE_SIZE_TO_PX,
|
|
7
8
|
PADDING_FROM_SIZE,
|
|
8
9
|
RADIUS_FROM_SIZE,
|
|
9
10
|
SIZE_TO_PX,
|
|
@@ -65,9 +66,9 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
65
66
|
overflow: hidden;
|
|
66
67
|
vertical-align: middle;
|
|
67
68
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
68
|
-
height: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
69
|
+
height: ${({ size, badge }) => (badge ? BADGE_SIZE_TO_PX[size] : SIZE_TO_PX[size])}px;
|
|
69
70
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
70
|
-
border-radius: ${({ badge, size }) => (badge ?
|
|
71
|
+
border-radius: ${({ badge, size }) => (badge ? 18 : RADIUS_FROM_SIZE[size])}px;
|
|
71
72
|
width: ${({ width }) => width || undefined};
|
|
72
73
|
transition: all 0.2s ease-out;
|
|
73
74
|
|
package/src/constants/sizes.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
export type TSizes = 'tiny' | 'small' | 'normal' | 'big' | 'huge';
|
|
2
2
|
export type TWeights = 'soft' | 'normal' | 'heavy';
|
|
3
3
|
|
|
4
|
+
export const SIZE_TO_NUMBER = {
|
|
5
|
+
tiny: 1,
|
|
6
|
+
small: 2,
|
|
7
|
+
normal: 3,
|
|
8
|
+
big: 4,
|
|
9
|
+
huge: 5,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const NUMBER_TO_SIZE = {
|
|
13
|
+
1: 'tiny',
|
|
14
|
+
2: 'small',
|
|
15
|
+
3: 'normal',
|
|
16
|
+
4: 'big',
|
|
17
|
+
5: 'huge',
|
|
18
|
+
};
|
|
19
|
+
|
|
4
20
|
export const SIZE_TO_PX = {
|
|
5
21
|
tiny: 10,
|
|
6
22
|
small: 20,
|
|
@@ -9,6 +25,14 @@ export const SIZE_TO_PX = {
|
|
|
9
25
|
huge: 50,
|
|
10
26
|
};
|
|
11
27
|
|
|
28
|
+
export const BADGE_SIZE_TO_PX = {
|
|
29
|
+
tiny: 10,
|
|
30
|
+
small: 17,
|
|
31
|
+
normal: 23,
|
|
32
|
+
big: 30,
|
|
33
|
+
huge: 36,
|
|
34
|
+
};
|
|
35
|
+
|
|
12
36
|
export const TABS_SIZE_TO_PX = {
|
|
13
37
|
tiny: 20,
|
|
14
38
|
small: 30,
|
|
@@ -121,7 +121,7 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, options }) =
|
|
|
121
121
|
isTablet,
|
|
122
122
|
isMobileOrTablet,
|
|
123
123
|
getAndIncreaseZIndex,
|
|
124
|
-
animations: options?.animations || { buttons: true },
|
|
124
|
+
animations: options?.animations || { buttons: true, dialogs: true },
|
|
125
125
|
}}
|
|
126
126
|
>
|
|
127
127
|
{size(notifications) > 0 ? (
|
package/src/helpers/colors.ts
CHANGED
|
@@ -140,3 +140,18 @@ export const getNotificationIntent = (theme: IReqoreTheme, intent?: TReqoreInten
|
|
|
140
140
|
|
|
141
141
|
export const getMainBackgroundColor = (theme: IReqoreTheme): string =>
|
|
142
142
|
changeLightness(theme.main, 0.02);
|
|
143
|
+
|
|
144
|
+
export const getColorFromMaybeIntentOrString = (
|
|
145
|
+
theme: IReqoreTheme,
|
|
146
|
+
intent: TReqoreIntent | string
|
|
147
|
+
): string => {
|
|
148
|
+
if (theme.intents[intent]) {
|
|
149
|
+
return theme.intents[intent];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (isValidSixCharHex(intent)) {
|
|
153
|
+
return intent;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return theme.main;
|
|
157
|
+
};
|
package/src/helpers/utils.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
isString,
|
|
9
9
|
isUndefined,
|
|
10
10
|
} from 'lodash';
|
|
11
|
+
import { NUMBER_TO_SIZE, SIZE_TO_NUMBER, TSizes } from '../constants/sizes';
|
|
11
12
|
|
|
12
13
|
export const sleep = async (ms: number) => await new Promise((r) => setTimeout(r, ms));
|
|
13
14
|
|
|
@@ -73,3 +74,12 @@ export const calculateStringSizeInPixels = (value: string = '', fontSize: number
|
|
|
73
74
|
Array.from(value).reduce((acc, cur) => acc + (widths[cur.charCodeAt(0)] ?? avg), 0) * fontSize
|
|
74
75
|
);
|
|
75
76
|
};
|
|
77
|
+
|
|
78
|
+
export const getOneLessSize = (size: TSizes): TSizes => {
|
|
79
|
+
// Get the initial sizes number
|
|
80
|
+
const initialSizeNumber: number = SIZE_TO_NUMBER[size];
|
|
81
|
+
// Reduce the size number by one
|
|
82
|
+
const oneLessSizeNumber: number = initialSizeNumber - 1 === 0 ? 1 : initialSizeNumber - 1;
|
|
83
|
+
// Get the size name from the number
|
|
84
|
+
return NUMBER_TO_SIZE[oneLessSizeNumber];
|
|
85
|
+
};
|
|
@@ -178,7 +178,7 @@ export default [
|
|
|
178
178
|
{
|
|
179
179
|
label: 'I have intent!',
|
|
180
180
|
content: (
|
|
181
|
-
<
|
|
181
|
+
<ReqoreP>
|
|
182
182
|
'Well would you look at that. Lorem ipsum dolor{' '}
|
|
183
183
|
<ReqoreTag label='dolor' icon='Briefcase3Line' /> <ReqoreTag label='sit amet' />,
|
|
184
184
|
consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis
|
|
@@ -220,7 +220,7 @@ export default [
|
|
|
220
220
|
nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci
|
|
221
221
|
luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero.
|
|
222
222
|
Phasellus dolor. Maecenas vestibulum mollis'
|
|
223
|
-
</
|
|
223
|
+
</ReqoreP>
|
|
224
224
|
),
|
|
225
225
|
expandable: true,
|
|
226
226
|
intent: 'info',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
2
|
+
import { noop } from 'lodash';
|
|
2
3
|
import ReqoreButton from '../../components/Button';
|
|
3
4
|
import { ReqoreControlGroup } from '../../index';
|
|
4
|
-
import { IconArg } from '../utils/args';
|
|
5
|
+
import { IconArg, SizeArg } from '../utils/args';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: 'Components/Button',
|
|
@@ -11,6 +12,7 @@ export default {
|
|
|
11
12
|
argTypes: {
|
|
12
13
|
...IconArg('icon', 'Icon'),
|
|
13
14
|
...IconArg('rightIcon', 'Right Icon'),
|
|
15
|
+
...SizeArg,
|
|
14
16
|
},
|
|
15
17
|
} as ComponentMeta<typeof ReqoreButton>;
|
|
16
18
|
|
|
@@ -18,7 +20,12 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
18
20
|
return (
|
|
19
21
|
<>
|
|
20
22
|
<ReqoreControlGroup size={buttonProps.size}>
|
|
23
|
+
<ReqoreButton {...buttonProps} icon='BankFill' rightIcon={null} />
|
|
24
|
+
<ReqoreButton {...buttonProps} />
|
|
21
25
|
<ReqoreButton {...buttonProps}>Default</ReqoreButton>
|
|
26
|
+
<ReqoreButton {...buttonProps} wrap maxWidth='150px'>
|
|
27
|
+
Default wrapped button with long text
|
|
28
|
+
</ReqoreButton>
|
|
22
29
|
<ReqoreButton {...buttonProps} disabled>
|
|
23
30
|
Disabled
|
|
24
31
|
</ReqoreButton>
|
|
@@ -37,6 +44,23 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
37
44
|
<ReqoreButton {...buttonProps} readOnly onClick={alert}>
|
|
38
45
|
Read only
|
|
39
46
|
</ReqoreButton>
|
|
47
|
+
<ReqoreButton {...buttonProps} readOnly badge={10} onClick={alert}>
|
|
48
|
+
With Badge
|
|
49
|
+
</ReqoreButton>
|
|
50
|
+
<ReqoreButton
|
|
51
|
+
{...buttonProps}
|
|
52
|
+
badge={{
|
|
53
|
+
effect: {
|
|
54
|
+
gradient: { colors: { 0: '#00fafd', 100: '#eb0e8c' }, direction: 'to right bottom' },
|
|
55
|
+
},
|
|
56
|
+
labelKey: 'Cool',
|
|
57
|
+
label: 1234,
|
|
58
|
+
actions: [{ icon: 'ShuffleLine', onClick: noop }],
|
|
59
|
+
}}
|
|
60
|
+
onClick={alert}
|
|
61
|
+
>
|
|
62
|
+
With modified Badge
|
|
63
|
+
</ReqoreButton>
|
|
40
64
|
</ReqoreControlGroup>
|
|
41
65
|
<br />
|
|
42
66
|
<ReqoreControlGroup fluid>
|
|
@@ -44,6 +68,50 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
44
68
|
Fluid button
|
|
45
69
|
</ReqoreButton>
|
|
46
70
|
</ReqoreControlGroup>
|
|
71
|
+
<br />
|
|
72
|
+
<ReqoreControlGroup>
|
|
73
|
+
<ReqoreButton
|
|
74
|
+
{...buttonProps}
|
|
75
|
+
description='This is a very interesting description for a button, I like it very much'
|
|
76
|
+
>
|
|
77
|
+
With Default Description
|
|
78
|
+
</ReqoreButton>
|
|
79
|
+
<ReqoreButton
|
|
80
|
+
{...buttonProps}
|
|
81
|
+
description='This is a very interesting description for a button, I like it very much'
|
|
82
|
+
maxWidth='200px'
|
|
83
|
+
badge={{
|
|
84
|
+
color: '#00fafd',
|
|
85
|
+
labelKey: 'Cool',
|
|
86
|
+
label: 1234,
|
|
87
|
+
actions: [{ icon: 'ShuffleLine', onClick: noop }],
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
With description and max width
|
|
91
|
+
</ReqoreButton>
|
|
92
|
+
<ReqoreButton
|
|
93
|
+
{...buttonProps}
|
|
94
|
+
description='This is a very interesting description for a button, I like it very much'
|
|
95
|
+
maxWidth='200px'
|
|
96
|
+
badge={{
|
|
97
|
+
effect: {
|
|
98
|
+
gradient: { colors: { 0: '#00fafd', 130: '#eb0e8c' }, direction: 'to right bottom' },
|
|
99
|
+
uppercase: true,
|
|
100
|
+
},
|
|
101
|
+
labelKey: 'Cool',
|
|
102
|
+
label: 1234,
|
|
103
|
+
actions: [{ icon: 'ShuffleLine', onClick: noop }],
|
|
104
|
+
}}
|
|
105
|
+
wrap
|
|
106
|
+
>
|
|
107
|
+
With description and max width, wrapped
|
|
108
|
+
</ReqoreButton>
|
|
109
|
+
<ReqoreButton
|
|
110
|
+
{...buttonProps}
|
|
111
|
+
description='This is a very interesting description for a button, I like it very much'
|
|
112
|
+
wrap
|
|
113
|
+
/>
|
|
114
|
+
</ReqoreControlGroup>
|
|
47
115
|
</>
|
|
48
116
|
);
|
|
49
117
|
};
|
|
@@ -2,7 +2,7 @@ import { Meta, Story } from '@storybook/react/types-6-0';
|
|
|
2
2
|
import { IReqoreMenuProps } from '../../components/Menu';
|
|
3
3
|
import { IReqoreMenuItemProps } from '../../components/Menu/item';
|
|
4
4
|
import { ReqoreMenu, ReqoreMenuDivider, ReqoreMenuItem, ReqorePopover } from '../../index';
|
|
5
|
-
import {
|
|
5
|
+
import { IntentArg, argManager } from '../utils/args';
|
|
6
6
|
|
|
7
7
|
const { createArg } = argManager<IReqoreMenuProps>();
|
|
8
8
|
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
},
|
|
29
29
|
}),
|
|
30
30
|
...createArg('wrapText', {
|
|
31
|
-
defaultValue:
|
|
31
|
+
defaultValue: false,
|
|
32
32
|
name: 'Wrap text',
|
|
33
33
|
control: {
|
|
34
34
|
type: 'boolean',
|
|
@@ -59,30 +59,49 @@ const Template: Story<IReqoreMenuProps> = (args) => {
|
|
|
59
59
|
Delete
|
|
60
60
|
</ReqoreMenuItem>
|
|
61
61
|
|
|
62
|
-
<ReqoreMenuItem icon='Lock2Fill'
|
|
62
|
+
<ReqoreMenuItem icon='Lock2Fill' description='I also have a description'>
|
|
63
|
+
This is a really long item that should wrap
|
|
64
|
+
</ReqoreMenuItem>
|
|
63
65
|
<ReqoreMenuItem icon='Lock2Fill' disabled>
|
|
64
66
|
Disabled
|
|
65
67
|
</ReqoreMenuItem>
|
|
66
68
|
<ReqoreMenuItem icon='Lock2Fill' disabled intent='warning'>
|
|
67
69
|
Disabled intent
|
|
68
70
|
</ReqoreMenuItem>
|
|
69
|
-
<ReqoreMenuDivider />
|
|
71
|
+
<ReqoreMenuDivider label='Divider' />
|
|
70
72
|
<ReqorePopover
|
|
71
73
|
component={ReqoreMenuItem}
|
|
72
74
|
componentProps={
|
|
73
75
|
{
|
|
74
76
|
icon: 'EmotionUnhappyLine',
|
|
75
77
|
rightIcon: 'Scissors2Fill',
|
|
78
|
+
wrap: args.wrapText,
|
|
79
|
+
flat: args.flat,
|
|
76
80
|
} as IReqoreMenuItemProps
|
|
77
81
|
}
|
|
82
|
+
openOnMount
|
|
78
83
|
content={
|
|
79
84
|
<ReqoreMenu {...args}>
|
|
80
85
|
<ReqoreMenuItem icon='ZhihuFill'>Item 1</ReqoreMenuItem>
|
|
81
|
-
<ReqoreMenuItem
|
|
86
|
+
<ReqoreMenuItem
|
|
87
|
+
icon='AccountCircleFill'
|
|
88
|
+
description='Would you look at that beautiful description'
|
|
89
|
+
intent='warning'
|
|
90
|
+
>
|
|
91
|
+
Item 2
|
|
92
|
+
</ReqoreMenuItem>
|
|
82
93
|
<ReqoreMenuItem icon='AnticlockwiseFill' disabled>
|
|
83
94
|
Item 3
|
|
84
95
|
</ReqoreMenuItem>
|
|
85
|
-
<ReqoreMenuItem
|
|
96
|
+
<ReqoreMenuItem
|
|
97
|
+
icon='ArchiveFill'
|
|
98
|
+
badge={{
|
|
99
|
+
label: '10',
|
|
100
|
+
effect: { gradient: { colors: { 0: '#00e3e8', 100: '#eb0e8c' } } },
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
Item 4
|
|
104
|
+
</ReqoreMenuItem>
|
|
86
105
|
</ReqoreMenu>
|
|
87
106
|
}
|
|
88
107
|
isReqoreComponent
|
|
@@ -91,7 +110,10 @@ const Template: Story<IReqoreMenuProps> = (args) => {
|
|
|
91
110
|
>
|
|
92
111
|
I have a submenu on click
|
|
93
112
|
</ReqorePopover>
|
|
94
|
-
<ReqoreMenuDivider
|
|
113
|
+
<ReqoreMenuDivider
|
|
114
|
+
label='Fancy divider'
|
|
115
|
+
effect={{ textAlign: 'left', gradient: { colors: { 0: '#0d5ba5', 100: '#ff5dfd' } } }}
|
|
116
|
+
/>
|
|
95
117
|
<ReqoreMenuItem icon='DualSim1Line' rightIcon='MoneyEuroBoxLine' selected>
|
|
96
118
|
I am selected!
|
|
97
119
|
</ReqoreMenuItem>
|
|
@@ -106,6 +128,8 @@ const Template: Story<IReqoreMenuProps> = (args) => {
|
|
|
106
128
|
},
|
|
107
129
|
},
|
|
108
130
|
}}
|
|
131
|
+
description='I also have a description'
|
|
132
|
+
badge={10}
|
|
109
133
|
>
|
|
110
134
|
Fancy
|
|
111
135
|
</ReqoreMenuItem>
|
|
@@ -116,5 +140,9 @@ const Template: Story<IReqoreMenuProps> = (args) => {
|
|
|
116
140
|
export const Basic = Template.bind({});
|
|
117
141
|
export const WrappedText = Template.bind({});
|
|
118
142
|
WrappedText.args = {
|
|
119
|
-
wrapText:
|
|
143
|
+
wrapText: true,
|
|
144
|
+
};
|
|
145
|
+
export const NotFlat = Template.bind({});
|
|
146
|
+
NotFlat.args = {
|
|
147
|
+
flat: false,
|
|
120
148
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
|
-
import ReqoreInput from '../../components/Input';
|
|
2
|
+
import ReqoreInput, { IReqoreInputProps } from '../../components/Input';
|
|
3
3
|
import { IReqorePanelProps, ReqorePanel } from '../../components/Panel';
|
|
4
|
-
import {
|
|
4
|
+
import { FlatArg, IconArg, IntentArg, argManager } from '../utils/args';
|
|
5
5
|
|
|
6
6
|
const { createArg } = argManager<IReqorePanelProps>();
|
|
7
7
|
|
|
@@ -67,9 +67,12 @@ const Template: Story<IReqorePanelProps> = (args: IReqorePanelProps) => {
|
|
|
67
67
|
{ label: 'Stacked Action 2', icon: 'CopperCoinFill', intent: 'danger' },
|
|
68
68
|
],
|
|
69
69
|
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
as: ReqoreInput,
|
|
71
|
+
props: {
|
|
72
|
+
placeholder: 'Custom action!',
|
|
73
|
+
icon: 'Search2Line',
|
|
74
|
+
minimal: false,
|
|
75
|
+
} as IReqoreInputProps,
|
|
73
76
|
},
|
|
74
77
|
{
|
|
75
78
|
label: 'More actions',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
2
|
import { IReqoreTabsProps } from '../../components/Tabs';
|
|
3
3
|
import { ReqoreTabs, ReqoreTabsContent } from '../../index';
|
|
4
|
-
import { argManager,
|
|
4
|
+
import { argManager, IntentArg, SizeArg } from '../utils/args';
|
|
5
5
|
|
|
6
6
|
const tabs = [
|
|
7
7
|
{
|
|
@@ -74,9 +74,14 @@ const { createArg } = argManager<IReqoreTabsProps>();
|
|
|
74
74
|
export default {
|
|
75
75
|
title: 'Components/Tabs',
|
|
76
76
|
argTypes: {
|
|
77
|
-
...FlatArg,
|
|
78
77
|
...SizeArg,
|
|
79
78
|
...IntentArg,
|
|
79
|
+
...createArg('flat', {
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
defaultValue: true,
|
|
82
|
+
name: 'Flat',
|
|
83
|
+
description: 'Whether the tabs should be flat or not',
|
|
84
|
+
}),
|
|
80
85
|
...createArg('fill', {
|
|
81
86
|
type: 'boolean',
|
|
82
87
|
defaultValue: false,
|
|
@@ -227,7 +232,7 @@ VerticalCustomWidth.args = {
|
|
|
227
232
|
width: '300px',
|
|
228
233
|
};
|
|
229
234
|
|
|
230
|
-
export const
|
|
231
|
-
|
|
232
|
-
flat:
|
|
235
|
+
export const NotFlat = Template.bind({});
|
|
236
|
+
NotFlat.args = {
|
|
237
|
+
flat: false,
|
|
233
238
|
};
|