@qoretechnologies/reqore 0.27.6 → 0.28.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__/tabs.test.tsx +1 -1
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/index.js +4 -5
- package/dist/components/Breadcrumbs/index.js.map +1 -1
- package/dist/components/Breadcrumbs/item.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/item.js +1 -1
- package/dist/components/Breadcrumbs/item.js.map +1 -1
- package/dist/components/Button/index.d.ts +8 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +49 -29
- 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/item.js +1 -1
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +2 -1
- 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 +5 -2
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +2 -1
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +17 -6
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Menu/index.js +2 -2
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Message/index.d.ts +2 -3
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +8 -7
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +3 -4
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +23 -20
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Panel/index.d.ts +3 -2
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +19 -11
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Table/row.js +1 -1
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +2 -6
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +19 -10
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts +8 -0
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +32 -12
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.d.ts +2 -1
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +8 -4
- package/dist/components/Tag/group.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 +50 -25
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/constants/sizes.d.ts +22 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +36 -14
- package/dist/constants/sizes.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +8 -4
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/utils.d.ts +1 -0
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +7 -2
- package/dist/helpers/utils.js.map +1 -1
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +5 -3
- package/dist/styles.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/Breadcrumbs/index.tsx +6 -21
- package/src/components/Breadcrumbs/item.tsx +1 -7
- package/src/components/Button/index.tsx +112 -58
- package/src/components/Checkbox/index.tsx +1 -1
- package/src/components/Collection/item.tsx +1 -1
- package/src/components/Effect/index.tsx +4 -0
- package/src/components/Header/index.tsx +6 -3
- package/src/components/Icon/index.tsx +21 -8
- package/src/components/Input/index.tsx +1 -1
- package/src/components/Menu/index.tsx +6 -6
- package/src/components/Message/index.tsx +20 -13
- package/src/components/Notifications/notification.tsx +46 -39
- package/src/components/Panel/index.tsx +40 -8
- package/src/components/Table/row.tsx +1 -1
- package/src/components/Tabs/index.tsx +2 -6
- package/src/components/Tabs/item.tsx +33 -24
- package/src/components/Tabs/list.tsx +47 -15
- package/src/components/Tag/group.tsx +22 -5
- package/src/components/Tag/index.tsx +120 -45
- package/src/constants/sizes.ts +39 -13
- package/src/containers/ReqoreProvider.tsx +1 -1
- package/src/containers/UIProvider.tsx +3 -0
- package/src/helpers/colors.ts +8 -4
- package/src/helpers/utils.ts +7 -2
- package/src/mock/collectionData.tsx +4 -0
- package/src/stories/Button/Button.stories.tsx +43 -17
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +2 -2
- package/src/stories/Message/Message.stories.tsx +6 -6
- package/src/stories/Notifications/Notification.stories.tsx +4 -3
- package/src/stories/Panel/Panel.stories.tsx +18 -1
- package/src/stories/Tabs/Tabs.stories.tsx +20 -13
- package/src/stories/Tag/Tag.stories.tsx +43 -0
- package/src/styles.ts +5 -2
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
package/dist/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":";;;;;;;AAAA,uDAAwC;AACxC,8CAAiF;AACjF,0CAAsD;AAEzC,QAAA,mBAAmB,OAAG,uBAAG,4PAAA,MAClC,EAAmB,uFAMnB,EAAqB,uFAKxB,KAXG,4BAAmB,EAMnB,8BAAqB,EAKvB;AAEW,QAAA,iBAAiB,OAAG,uBAAG,oHAAA,MAChC,EAAiB,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":";;;;;;;AAAA,uDAAwC;AACxC,8CAAiF;AACjF,0CAAsD;AAEzC,QAAA,mBAAmB,GAAG,IAAI,CAAC;AAC3B,QAAA,iBAAiB,GAAG,CAAC,CAAC;AAEtB,QAAA,mBAAmB,OAAG,uBAAG,4PAAA,MAClC,EAAmB,uFAMnB,EAAqB,uFAKxB,KAXG,4BAAmB,EAMnB,8BAAqB,EAKvB;AAEW,QAAA,iBAAiB,OAAG,uBAAG,oHAAA,MAChC,EAAiB,2BACE,EAAmB,WAEzC,KAHG,wBAAiB,EACE,2BAAmB,EAExC;AAEW,QAAA,eAAe,OAAG,uBAAG,oHAAA,MAC9B,EAAiB,2BACE,EAAiB,WAEvC,KAHG,wBAAiB,EACE,yBAAiB,EAEtC;AAEW,QAAA,gBAAgB,OAAG,uBAAG,gHAAA,iCAG7B,EAAe,SAEpB,KAFK,uBAAe,EAEnB;AAEW,QAAA,eAAe,OAAG,uBAAG,0IAAA,sEAIjC,KAAC;AAEW,QAAA,eAAe,OAAG,uBAAG,yHAAA,qDAGjC,KAAC"}
|
package/dist/types/global.d.ts
CHANGED
|
@@ -116,6 +116,19 @@ export interface IWithReqoreFlat {
|
|
|
116
116
|
*/
|
|
117
117
|
flat?: boolean;
|
|
118
118
|
}
|
|
119
|
+
export interface IWithReqoreMinimal {
|
|
120
|
+
/**
|
|
121
|
+
* If true, the component will be minimal
|
|
122
|
+
* @default false
|
|
123
|
+
* @type boolean
|
|
124
|
+
* @example
|
|
125
|
+
* <ReqoreButton minimal />
|
|
126
|
+
* <ReqoreButton minimal={true} />
|
|
127
|
+
* <ReqoreButton minimal={false} />
|
|
128
|
+
*
|
|
129
|
+
*/
|
|
130
|
+
minimal?: boolean;
|
|
131
|
+
}
|
|
119
132
|
export interface IWithReqoreEffect {
|
|
120
133
|
/**
|
|
121
134
|
* If true, the component will have an effect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;CAAG;AAC1D,oBAAY,kBAAkB,GAAG,MAAM,GAAG,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;CAAG;AAC1D,oBAAY,kBAAkB,GAAG,MAAM,GAAG,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { useMeasure } from 'react-use';
|
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
5
|
import { ReqorePopover } from '../..';
|
|
6
6
|
import {
|
|
7
|
+
ICON_FROM_SIZE,
|
|
7
8
|
MARGIN_FROM_SIZE,
|
|
8
9
|
PADDING_FROM_SIZE,
|
|
9
10
|
TABS_SIZE_TO_PX,
|
|
@@ -21,7 +22,7 @@ import ReqoreMenu from '../Menu';
|
|
|
21
22
|
import ReqoreMenuItem from '../Menu/item';
|
|
22
23
|
import { IReqoreTabsListItem } from '../Tabs';
|
|
23
24
|
import { StyledTabListItem } from '../Tabs/item';
|
|
24
|
-
import ReqoreTabsList, {
|
|
25
|
+
import ReqoreTabsList, { StyledReqoreTabsList, getTabsLength } from '../Tabs/list';
|
|
25
26
|
import ReqoreBreadcrumbsItem, { IReqoreBreadcrumbItemProps } from './item';
|
|
26
27
|
|
|
27
28
|
export interface IReqoreBreadcrumbItemTabs {
|
|
@@ -104,7 +105,6 @@ const StyledBreadcrumbsTabsWrapper = styled.div`
|
|
|
104
105
|
`;
|
|
105
106
|
|
|
106
107
|
const itemPadding = 27;
|
|
107
|
-
const iconSize = 11;
|
|
108
108
|
const arrowSize = 50;
|
|
109
109
|
|
|
110
110
|
const getBreadcrumbsLength = (
|
|
@@ -128,7 +128,7 @@ const getBreadcrumbsLength = (
|
|
|
128
128
|
return (
|
|
129
129
|
len +
|
|
130
130
|
itemPadding +
|
|
131
|
-
|
|
131
|
+
ICON_FROM_SIZE[size] +
|
|
132
132
|
arrowSize +
|
|
133
133
|
calculateStringSizeInPixels(item.label || '', TEXT_FROM_SIZE[size])
|
|
134
134
|
);
|
|
@@ -185,12 +185,7 @@ const ReqoreBreadcrumbs: React.FC<IReqoreBreadcrumbsProps> = ({
|
|
|
185
185
|
if (isArray(item)) {
|
|
186
186
|
return (
|
|
187
187
|
<React.Fragment key={index}>
|
|
188
|
-
<ReqoreIcon
|
|
189
|
-
icon='ArrowRightSLine'
|
|
190
|
-
size={`${TEXT_FROM_SIZE[size]}px`}
|
|
191
|
-
key={'icon' + index}
|
|
192
|
-
margin='both'
|
|
193
|
-
/>
|
|
188
|
+
<ReqoreIcon icon='ArrowRightSLine' size={size} key={'icon' + index} margin='both' />
|
|
194
189
|
<ReqorePopover
|
|
195
190
|
key={index}
|
|
196
191
|
component={ReqoreBreadcrumbsItem}
|
|
@@ -229,12 +224,7 @@ const ReqoreBreadcrumbs: React.FC<IReqoreBreadcrumbsProps> = ({
|
|
|
229
224
|
if (item.withTabs) {
|
|
230
225
|
return (
|
|
231
226
|
<StyledBreadcrumbsTabsWrapper key={index}>
|
|
232
|
-
<ReqoreIcon
|
|
233
|
-
icon='ArrowRightSLine'
|
|
234
|
-
size={`${TEXT_FROM_SIZE[size]}px`}
|
|
235
|
-
key={'icon' + index}
|
|
236
|
-
margin='both'
|
|
237
|
-
/>
|
|
227
|
+
<ReqoreIcon icon='ArrowRightSLine' size={size} key={'icon' + index} margin='both' />
|
|
238
228
|
<ReqoreTabsList
|
|
239
229
|
tabs={item.withTabs.tabs}
|
|
240
230
|
onTabChange={item.withTabs.onTabChange}
|
|
@@ -251,12 +241,7 @@ const ReqoreBreadcrumbs: React.FC<IReqoreBreadcrumbsProps> = ({
|
|
|
251
241
|
return (
|
|
252
242
|
<React.Fragment key={index}>
|
|
253
243
|
{index !== 0 && (
|
|
254
|
-
<ReqoreIcon
|
|
255
|
-
icon='ArrowRightSLine'
|
|
256
|
-
size={`${TEXT_FROM_SIZE[size]}px`}
|
|
257
|
-
key={'icon' + index}
|
|
258
|
-
margin='both'
|
|
259
|
-
/>
|
|
244
|
+
<ReqoreIcon icon='ArrowRightSLine' size={size} key={'icon' + index} margin='both' />
|
|
260
245
|
)}
|
|
261
246
|
<ReqoreBreadcrumbsItem {...item} key={index} customTheme={customTheme} size={size} />
|
|
262
247
|
</React.Fragment>
|
|
@@ -137,13 +137,7 @@ const ReqoreBreadcrumbsItem = forwardRef<HTMLDivElement, IReqoreBreadcrumbItemPr
|
|
|
137
137
|
theme={theme}
|
|
138
138
|
size={size}
|
|
139
139
|
>
|
|
140
|
-
{icon &&
|
|
141
|
-
<ReqoreIcon
|
|
142
|
-
icon={icon}
|
|
143
|
-
size={`${TEXT_FROM_SIZE[size]}px`}
|
|
144
|
-
margin={label ? 'right' : undefined}
|
|
145
|
-
/>
|
|
146
|
-
)}
|
|
140
|
+
{icon && <ReqoreIcon icon={icon} size={size} margin={label ? 'right' : undefined} />}
|
|
147
141
|
{label && (
|
|
148
142
|
<StyledAnimatedTextWrapper as={as || 'span'} {...props}>
|
|
149
143
|
<StyledActiveContent>{label}</StyledActiveContent>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, { forwardRef, memo, useContext } from 'react';
|
|
1
|
+
import React, { forwardRef, memo, useCallback, useContext } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import {
|
|
4
|
+
ICON_FROM_SIZE,
|
|
4
5
|
PADDING_FROM_SIZE,
|
|
5
6
|
RADIUS_FROM_SIZE,
|
|
6
7
|
SIZE_TO_PX,
|
|
@@ -26,6 +27,7 @@ import {
|
|
|
26
27
|
IReqoreIntent,
|
|
27
28
|
IReqoreReadOnly,
|
|
28
29
|
IWithReqoreEffect,
|
|
30
|
+
IWithReqoreSize,
|
|
29
31
|
TReqoreTooltipProp,
|
|
30
32
|
} from '../../types/global';
|
|
31
33
|
import { IReqoreIconName } from '../../types/icons';
|
|
@@ -33,6 +35,9 @@ import { ReqoreTextEffect, StyledEffect, StyledTextEffect } from '../Effect';
|
|
|
33
35
|
import ReqoreIcon from '../Icon';
|
|
34
36
|
import { ReqoreSpacer } from '../Spacer';
|
|
35
37
|
import ReqoreTag, { IReqoreTagProps } from '../Tag';
|
|
38
|
+
import ReqoreTagGroup from '../Tag/group';
|
|
39
|
+
|
|
40
|
+
export type TReqoreBadge = string | number | IReqoreTagProps;
|
|
36
41
|
|
|
37
42
|
export interface IReqoreButtonProps
|
|
38
43
|
extends React.HTMLAttributes<HTMLButtonElement>,
|
|
@@ -51,7 +56,7 @@ export interface IReqoreButtonProps
|
|
|
51
56
|
rightIcon?: IReqoreIconName;
|
|
52
57
|
customTheme?: IReqoreCustomTheme;
|
|
53
58
|
wrap?: boolean;
|
|
54
|
-
badge?:
|
|
59
|
+
badge?: TReqoreBadge | TReqoreBadge[];
|
|
55
60
|
description?: string | number;
|
|
56
61
|
maxWidth?: string;
|
|
57
62
|
textAlign?: 'left' | 'center' | 'right';
|
|
@@ -73,7 +78,6 @@ const getButtonMainColor = (theme: IReqoreTheme, color?: string) => {
|
|
|
73
78
|
export const StyledAnimatedTextWrapper = styled.span`
|
|
74
79
|
overflow: hidden;
|
|
75
80
|
position: relative;
|
|
76
|
-
padding: 4px 0;
|
|
77
81
|
text-align: left;
|
|
78
82
|
`;
|
|
79
83
|
|
|
@@ -85,13 +89,16 @@ export const StyledActiveContent = styled.span`
|
|
|
85
89
|
filter: blur(10px);
|
|
86
90
|
|
|
87
91
|
${({ wrap }) =>
|
|
88
|
-
!wrap
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
!wrap
|
|
93
|
+
? css`
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
text-overflow: ellipsis;
|
|
96
|
+
white-space: nowrap;
|
|
97
|
+
width: 100%;
|
|
98
|
+
`
|
|
99
|
+
: css`
|
|
100
|
+
word-break: break-word;
|
|
101
|
+
`}
|
|
95
102
|
`;
|
|
96
103
|
|
|
97
104
|
export const StyledInActiveContent = styled.span`
|
|
@@ -100,13 +107,16 @@ export const StyledInActiveContent = styled.span`
|
|
|
100
107
|
transition: all 0.2s ease-out;
|
|
101
108
|
|
|
102
109
|
${({ wrap }) =>
|
|
103
|
-
!wrap
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
!wrap
|
|
111
|
+
? css`
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
text-overflow: ellipsis;
|
|
114
|
+
white-space: nowrap;
|
|
115
|
+
width: 100%;
|
|
116
|
+
`
|
|
117
|
+
: css`
|
|
118
|
+
word-break: break-word;
|
|
119
|
+
`}
|
|
110
120
|
`;
|
|
111
121
|
|
|
112
122
|
export const StyledInvisibleContent = styled.span`
|
|
@@ -115,10 +125,13 @@ export const StyledInvisibleContent = styled.span`
|
|
|
115
125
|
overflow: hidden;
|
|
116
126
|
|
|
117
127
|
${({ wrap }) =>
|
|
118
|
-
!wrap
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
128
|
+
!wrap
|
|
129
|
+
? css`
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
`
|
|
132
|
+
: css`
|
|
133
|
+
word-break: break-word;
|
|
134
|
+
`}
|
|
122
135
|
`;
|
|
123
136
|
|
|
124
137
|
export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
@@ -139,7 +152,7 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
139
152
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
140
153
|
max-width: ${({ maxWidth }) => maxWidth || undefined};
|
|
141
154
|
|
|
142
|
-
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
155
|
+
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
143
156
|
|
|
144
157
|
border-radius: ${({ size }) => RADIUS_FROM_SIZE[size]}px;
|
|
145
158
|
|
|
@@ -160,8 +173,8 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
160
173
|
|
|
161
174
|
${InactiveIconScale}
|
|
162
175
|
|
|
163
|
-
${({ readOnly, animate }) =>
|
|
164
|
-
!readOnly
|
|
176
|
+
${({ readOnly, animate, active }) =>
|
|
177
|
+
!readOnly && !active
|
|
165
178
|
? css`
|
|
166
179
|
&:not(:disabled) {
|
|
167
180
|
${ScaleIconOnHover}
|
|
@@ -174,13 +187,18 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
174
187
|
}
|
|
175
188
|
|
|
176
189
|
&:hover,
|
|
190
|
+
&:active,
|
|
177
191
|
&:focus {
|
|
178
|
-
background-color: ${({ theme, color }: IReqoreButtonStyle) =>
|
|
179
|
-
changeLightness(getButtonMainColor(theme, color), 0.05)};
|
|
180
|
-
color: ${({ theme, color }) =>
|
|
181
|
-
getReadableColor(
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
background-color: ${({ theme, color, minimal }: IReqoreButtonStyle) =>
|
|
193
|
+
minimal ? `#00000030` : changeLightness(getButtonMainColor(theme, color), 0.05)};
|
|
194
|
+
color: ${({ theme, color, minimal }) =>
|
|
195
|
+
getReadableColor(
|
|
196
|
+
{ main: minimal ? '#00000030' : getButtonMainColor(theme, color) },
|
|
197
|
+
undefined,
|
|
198
|
+
undefined
|
|
199
|
+
)};
|
|
200
|
+
border-color: ${({ flat, theme, color }) =>
|
|
201
|
+
flat ? undefined : changeLightness(getButtonMainColor(theme, color), 0.1)};
|
|
184
202
|
|
|
185
203
|
${animate &&
|
|
186
204
|
css`
|
|
@@ -199,18 +217,27 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
199
217
|
}
|
|
200
218
|
}
|
|
201
219
|
`
|
|
202
|
-
:
|
|
220
|
+
: readOnly
|
|
221
|
+
? css`
|
|
203
222
|
${ReadOnlyElement};
|
|
204
|
-
`
|
|
223
|
+
`
|
|
224
|
+
: undefined}
|
|
205
225
|
|
|
206
|
-
${({ active,
|
|
226
|
+
${({ active, flat, theme, color }: IReqoreButtonStyle) =>
|
|
207
227
|
active &&
|
|
208
228
|
css`
|
|
209
|
-
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
background-color: ${changeLightness(getButtonMainColor(theme, color), 0.1)};
|
|
210
231
|
color: ${getReadableColor({ main: getButtonMainColor(theme, color) }, undefined, undefined)};
|
|
211
|
-
border-color: ${
|
|
212
|
-
|
|
213
|
-
|
|
232
|
+
border-color: ${flat ? undefined : changeLightness(getButtonMainColor(theme, color), 0.175)};
|
|
233
|
+
|
|
234
|
+
&:hover,
|
|
235
|
+
&:active,
|
|
236
|
+
&:focus {
|
|
237
|
+
border-color: ${flat
|
|
238
|
+
? undefined
|
|
239
|
+
: changeLightness(getButtonMainColor(theme, color), 0.275)};
|
|
240
|
+
}
|
|
214
241
|
|
|
215
242
|
${ActiveIconScale}
|
|
216
243
|
`}
|
|
@@ -239,8 +266,10 @@ export const StyledButtonContent = styled.div`
|
|
|
239
266
|
align-items: center;
|
|
240
267
|
width: 100%;
|
|
241
268
|
height: 100%;
|
|
269
|
+
min-width: ${({ size }) => ICON_FROM_SIZE[size]}px;
|
|
242
270
|
flex: 1;
|
|
243
271
|
flex-shrink: 0;
|
|
272
|
+
padding: 4px 0;
|
|
244
273
|
min-height: ${({ size, flat }) => (flat ? SIZE_TO_PX[size] : SIZE_TO_PX[size] - 2)}px;
|
|
245
274
|
${({ wrap, description }) =>
|
|
246
275
|
!wrap && !description
|
|
@@ -250,6 +279,47 @@ export const StyledButtonContent = styled.div`
|
|
|
250
279
|
: null}
|
|
251
280
|
`;
|
|
252
281
|
|
|
282
|
+
export interface IReqoreButtonBadgeProps extends IWithReqoreSize {
|
|
283
|
+
color?: string;
|
|
284
|
+
content?: TReqoreBadge | TReqoreBadge[];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const ButtonBadge = memo((props: IReqoreButtonBadgeProps) => {
|
|
288
|
+
const renderTag = useCallback(
|
|
289
|
+
({ size, color, content, key }: IReqoreButtonBadgeProps & { key: number }) => (
|
|
290
|
+
<ReqoreTag
|
|
291
|
+
key={key}
|
|
292
|
+
size={getOneLessSize(size)}
|
|
293
|
+
badge
|
|
294
|
+
color={color ? `${color}70` : undefined}
|
|
295
|
+
{...(typeof content === 'string' || typeof content === 'number'
|
|
296
|
+
? { label: content }
|
|
297
|
+
: content)}
|
|
298
|
+
/>
|
|
299
|
+
),
|
|
300
|
+
[props]
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
// If the content is a list
|
|
304
|
+
if (Array.isArray(props.content)) {
|
|
305
|
+
return (
|
|
306
|
+
<>
|
|
307
|
+
<ReqoreSpacer width={PADDING_FROM_SIZE[props.size]} />
|
|
308
|
+
<ReqoreTagGroup hasBottomMargin={false}>
|
|
309
|
+
{props.content.map((badge, index) => renderTag({ ...props, content: badge, key: index }))}
|
|
310
|
+
</ReqoreTagGroup>
|
|
311
|
+
</>
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return (
|
|
316
|
+
<>
|
|
317
|
+
<ReqoreSpacer width={PADDING_FROM_SIZE[props.size]} />
|
|
318
|
+
{renderTag({ ...props, key: 0 })}
|
|
319
|
+
</>
|
|
320
|
+
);
|
|
321
|
+
});
|
|
322
|
+
|
|
253
323
|
const ReqoreButton = memo(
|
|
254
324
|
forwardRef<HTMLButtonElement, IReqoreButtonProps>(
|
|
255
325
|
(
|
|
@@ -286,7 +356,7 @@ const ReqoreButton = memo(
|
|
|
286
356
|
useTooltip(targetRef.current, tooltip);
|
|
287
357
|
|
|
288
358
|
// If color or intent was specified, set the color
|
|
289
|
-
const customColor = theme.main;
|
|
359
|
+
const customColor = intent ? theme.main : changeLightness(theme.main, 0.07);
|
|
290
360
|
const _flat = minimal ? flat : flat !== false;
|
|
291
361
|
const color = customColor
|
|
292
362
|
? minimal
|
|
@@ -294,18 +364,6 @@ const ReqoreButton = memo(
|
|
|
294
364
|
: getReadableColorFrom(customColor, true)
|
|
295
365
|
: getReadableColor(theme, undefined, undefined, true);
|
|
296
366
|
|
|
297
|
-
const renderBadge = () => (
|
|
298
|
-
<>
|
|
299
|
-
<ReqoreSpacer width={PADDING_FROM_SIZE[size]} />
|
|
300
|
-
<ReqoreTag
|
|
301
|
-
size={getOneLessSize(size)}
|
|
302
|
-
badge
|
|
303
|
-
color={`${color}70`}
|
|
304
|
-
{...(typeof badge === 'string' || typeof badge === 'number' ? { label: badge } : badge)}
|
|
305
|
-
/>
|
|
306
|
-
</>
|
|
307
|
-
);
|
|
308
|
-
|
|
309
367
|
return (
|
|
310
368
|
<StyledButton
|
|
311
369
|
{...rest}
|
|
@@ -333,7 +391,7 @@ const ReqoreButton = memo(
|
|
|
333
391
|
<StyledButtonContent size={size} wrap={wrap} description={description} flat={_flat}>
|
|
334
392
|
{icon && (
|
|
335
393
|
<>
|
|
336
|
-
<ReqoreIcon icon={icon} size={
|
|
394
|
+
<ReqoreIcon icon={icon} size={size} />
|
|
337
395
|
{children || badge || rightIcon ? (
|
|
338
396
|
<ReqoreSpacer width={PADDING_FROM_SIZE[size]} />
|
|
339
397
|
) : null}
|
|
@@ -344,18 +402,14 @@ const ReqoreButton = memo(
|
|
|
344
402
|
<StyledActiveContent wrap={wrap}>{children}</StyledActiveContent>
|
|
345
403
|
<StyledInActiveContent wrap={wrap}>{children}</StyledInActiveContent>
|
|
346
404
|
<StyledInvisibleContent wrap={wrap}>{children}</StyledInvisibleContent>
|
|
347
|
-
{badge && wrap ?
|
|
405
|
+
{badge && wrap ? <ButtonBadge content={badge} size={size} color={color} /> : null}
|
|
348
406
|
</StyledAnimatedTextWrapper>
|
|
349
407
|
)}
|
|
350
|
-
{badge && !wrap ?
|
|
408
|
+
{badge && !wrap ? <ButtonBadge content={badge} size={size} color={color} /> : null}
|
|
351
409
|
{rightIcon && (
|
|
352
410
|
<>
|
|
353
411
|
{children || badge ? <ReqoreSpacer width={PADDING_FROM_SIZE[size]} /> : null}
|
|
354
|
-
<ReqoreIcon
|
|
355
|
-
icon={rightIcon}
|
|
356
|
-
size={`${TEXT_FROM_SIZE[size]}px`}
|
|
357
|
-
style={{ marginLeft: 'auto' }}
|
|
358
|
-
/>
|
|
412
|
+
<ReqoreIcon icon={rightIcon} size={size} style={{ marginLeft: 'auto' }} />
|
|
359
413
|
</>
|
|
360
414
|
)}
|
|
361
415
|
</StyledButtonContent>
|
|
@@ -151,7 +151,7 @@ const Checkbox = forwardRef<HTMLDivElement, IReqoreCheckboxProps>(
|
|
|
151
151
|
<StyledSwitch size={size} labelPosition={labelPosition} checked={checked} />
|
|
152
152
|
) : (
|
|
153
153
|
<ReqoreIcon
|
|
154
|
-
size={
|
|
154
|
+
size={size}
|
|
155
155
|
icon={checked ? checkedIcon : uncheckedIcon}
|
|
156
156
|
margin={labelPosition}
|
|
157
157
|
/>
|
|
@@ -182,7 +182,7 @@ export const ReqoreCollectionItem = ({
|
|
|
182
182
|
{ icon: 'CloseLine', onClick: handleItemClick },
|
|
183
183
|
] as IReqorePanelAction[])
|
|
184
184
|
: size(actions)
|
|
185
|
-
? [{ icon: 'More2Fill', actions }]
|
|
185
|
+
? [{ icon: 'More2Fill', actions, minimal: true, flat: true }]
|
|
186
186
|
: undefined;
|
|
187
187
|
|
|
188
188
|
return (
|
|
@@ -72,6 +72,8 @@ export const StyledEffect = styled.span`
|
|
|
72
72
|
const gradient = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColors})`;
|
|
73
73
|
const gradientActive = `${gradientType}-gradient(${gradientDirectionOrShape}${gradientColorsActive})`;
|
|
74
74
|
|
|
75
|
+
console.log(effect);
|
|
76
|
+
|
|
75
77
|
return css`
|
|
76
78
|
background-image: ${gradient};
|
|
77
79
|
// Get the first color from the colors object
|
|
@@ -86,6 +88,8 @@ export const StyledEffect = styled.span`
|
|
|
86
88
|
|
|
87
89
|
${effect.interactive &&
|
|
88
90
|
css`
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
|
|
89
93
|
&:hover,
|
|
90
94
|
&:focus,
|
|
91
95
|
&:active {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { memo, useMemo } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import { HEADER_SIZE_TO_NUMBER, TSizes } from '../../constants/sizes';
|
|
3
4
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
4
5
|
import { getReadableColor } from '../../helpers/colors';
|
|
6
|
+
import { isStringSize } from '../../helpers/utils';
|
|
5
7
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
6
8
|
import { IWithReqoreEffect } from '../../types/global';
|
|
7
9
|
import { StyledTextEffect } from '../Effect';
|
|
@@ -10,7 +12,7 @@ export interface IReqoreHeadingProps
|
|
|
10
12
|
extends IWithReqoreEffect,
|
|
11
13
|
React.HTMLAttributes<HTMLHeadingElement> {
|
|
12
14
|
intent?: TReqoreIntent;
|
|
13
|
-
size?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
15
|
+
size?: 1 | 2 | 3 | 4 | 5 | 6 | TSizes;
|
|
14
16
|
customTheme?: Partial<IReqoreTheme>;
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -28,9 +30,10 @@ export const StyledHeader = styled(StyledTextEffect)`
|
|
|
28
30
|
export const ReqoreHeading = memo(
|
|
29
31
|
({ size, children, customTheme, intent, ...props }: IReqoreHeadingProps) => {
|
|
30
32
|
const theme = useReqoreTheme('main', customTheme, intent);
|
|
33
|
+
const _size: number = isStringSize(size) ? HEADER_SIZE_TO_NUMBER[size] : size;
|
|
31
34
|
const HTMLheaderElement = useMemo(() => {
|
|
32
|
-
return `h${
|
|
33
|
-
}, [
|
|
35
|
+
return `h${_size}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
36
|
+
}, [_size]);
|
|
34
37
|
|
|
35
38
|
return (
|
|
36
39
|
<StyledHeader as={HTMLheaderElement} theme={theme} intent={intent} {...props}>
|
|
@@ -4,13 +4,15 @@ 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
|
+
import { ICON_FROM_SIZE, PADDING_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
7
8
|
import { TReqoreIntent } from '../../constants/theme';
|
|
9
|
+
import { isStringSize } from '../../helpers/utils';
|
|
8
10
|
import { IReqoreIconName } from '../../types/icons';
|
|
9
11
|
|
|
10
12
|
export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
11
13
|
icon: IReqoreIconName;
|
|
12
14
|
color?: string;
|
|
13
|
-
size?: string;
|
|
15
|
+
size?: TSizes | string;
|
|
14
16
|
iconProps?: IconBaseProps;
|
|
15
17
|
intent?: TReqoreIntent;
|
|
16
18
|
margin?: 'right' | 'left' | 'both';
|
|
@@ -22,18 +24,26 @@ export const StyledIconWrapper = styled.span<{ margin: 'right' | 'left' | 'both'
|
|
|
22
24
|
vertical-align: text-bottom;
|
|
23
25
|
transition: all 0.2s ease-out;
|
|
24
26
|
|
|
25
|
-
${({ margin }) =>
|
|
27
|
+
${({ margin, size }) =>
|
|
26
28
|
margin &&
|
|
27
29
|
css`
|
|
28
|
-
margin-left: ${
|
|
29
|
-
|
|
30
|
+
margin-left: ${margin === 'left' || margin === 'both'
|
|
31
|
+
? isStringSize(size)
|
|
32
|
+
? `${PADDING_FROM_SIZE[size]}px`
|
|
33
|
+
: '10px'
|
|
34
|
+
: undefined};
|
|
35
|
+
margin-right: ${margin === 'right' || margin === 'both'
|
|
36
|
+
? isStringSize(size)
|
|
37
|
+
? `${PADDING_FROM_SIZE[size]}px`
|
|
38
|
+
: '10px'
|
|
39
|
+
: undefined};
|
|
30
40
|
`}
|
|
31
41
|
`;
|
|
32
42
|
|
|
33
43
|
const ReqoreIcon = memo(
|
|
34
44
|
({
|
|
35
45
|
icon,
|
|
36
|
-
size = '
|
|
46
|
+
size = 'normal',
|
|
37
47
|
className,
|
|
38
48
|
color,
|
|
39
49
|
margin,
|
|
@@ -45,14 +55,16 @@ const ReqoreIcon = memo(
|
|
|
45
55
|
const theme = useContext(ReqoreThemeContext);
|
|
46
56
|
const Icon: IconType = RemixIcons[`Ri${icon}`];
|
|
47
57
|
const finalColor: string | undefined = intent ? theme.intents[intent] : color;
|
|
58
|
+
const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
|
|
48
59
|
|
|
49
60
|
if (!Icon) {
|
|
50
61
|
return (
|
|
51
62
|
<StyledIconWrapper
|
|
52
63
|
{...rest}
|
|
64
|
+
size={size}
|
|
53
65
|
margin={margin}
|
|
54
66
|
className={`${className || ''} reqore-icon`}
|
|
55
|
-
style={{ ...style, width:
|
|
67
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
56
68
|
/>
|
|
57
69
|
);
|
|
58
70
|
}
|
|
@@ -61,13 +73,14 @@ const ReqoreIcon = memo(
|
|
|
61
73
|
<StyledIconWrapper
|
|
62
74
|
{...rest}
|
|
63
75
|
margin={margin}
|
|
64
|
-
|
|
76
|
+
size={size}
|
|
77
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
65
78
|
className={`${className || ''} reqore-icon`}
|
|
66
79
|
>
|
|
67
80
|
<IconContext.Provider
|
|
68
81
|
value={{
|
|
69
82
|
color: finalColor || 'inherit',
|
|
70
|
-
size,
|
|
83
|
+
size: finalSize,
|
|
71
84
|
style: {
|
|
72
85
|
verticalAlign: 'super',
|
|
73
86
|
},
|
|
@@ -176,7 +176,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
176
176
|
>
|
|
177
177
|
{icon && (
|
|
178
178
|
<StyledIconWrapper _size={size}>
|
|
179
|
-
<ReqoreIcon size={
|
|
179
|
+
<ReqoreIcon size={size} icon={icon} />
|
|
180
180
|
</StyledIconWrapper>
|
|
181
181
|
)}
|
|
182
182
|
<StyledInput
|
|
@@ -67,18 +67,18 @@ const ReqoreMenu = forwardRef<HTMLDivElement, IReqoreMenuProps>(
|
|
|
67
67
|
return (
|
|
68
68
|
<ReqoreThemeProvider theme={theme}>
|
|
69
69
|
<StyledReqoreMenu {...rest} position={position} ref={ref} theme={theme}>
|
|
70
|
-
{React.Children.map(children, (child) =>
|
|
71
|
-
child
|
|
70
|
+
{React.Children.map(children, (child) => {
|
|
71
|
+
return child
|
|
72
72
|
? // @ts-ignore
|
|
73
73
|
React.cloneElement(child, {
|
|
74
74
|
_insidePopover,
|
|
75
75
|
_popoverId,
|
|
76
|
-
customTheme: theme,
|
|
76
|
+
customTheme: child?.props.customTheme || theme,
|
|
77
77
|
wrap: wrapText,
|
|
78
|
-
flat,
|
|
78
|
+
flat: child?.props.flat || flat,
|
|
79
79
|
})
|
|
80
|
-
: null
|
|
81
|
-
)}
|
|
80
|
+
: null;
|
|
81
|
+
})}
|
|
82
82
|
</StyledReqoreMenu>
|
|
83
83
|
</ReqoreThemeProvider>
|
|
84
84
|
);
|