@synerise/ds-card-tabs 0.8.71 → 0.8.75
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/CHANGELOG.md +42 -0
- package/README.md +1 -0
- package/dist/CardTab/CardTab.d.ts +1 -1
- package/dist/CardTab/CardTab.js +10 -5
- package/dist/CardTab/CardTab.styles.d.ts +6 -0
- package/dist/CardTab/CardTab.styles.js +152 -84
- package/dist/CardTab/CardTab.types.d.ts +3 -1
- package/dist/CardTab/CardTab.types.js +1 -0
- package/dist/CardTab/CardTabPrefix/CardTabPrefix.js +9 -5
- package/dist/CardTab/CardTabPrefix/CardTabPrefix.types.d.ts +1 -0
- package/dist/CardTab/ColorsTabs.d.ts +1 -0
- package/dist/CardTab/ColorsTabs.js +2 -0
- package/dist/CardTabs.js +21 -3
- package/dist/CardTabs.styles.js +7 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,48 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.8.75](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-tabs@0.8.74...@synerise/ds-card-tabs@0.8.75) (2021-10-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **card-tabs:** add colorDot and fix props ([e8a9577](https://github.com/Synerise/synerise-design/commit/e8a9577e7f07a4aa05d0e1bb139fb1a07e967b53))
|
|
12
|
+
* **card-tabs:** add colorDot and fix props ([e779c6a](https://github.com/Synerise/synerise-design/commit/e779c6a433bbd7755171afc42a63e8e3410e8a82))
|
|
13
|
+
* **card-tabs:** add ghost color when is draggable ([87b7239](https://github.com/Synerise/synerise-design/commit/87b7239628b0ddd6643e59a1a887f829e2d654d7))
|
|
14
|
+
* **card-tabs:** fix color active state dotand add tooltip ([9f69e73](https://github.com/Synerise/synerise-design/commit/9f69e73e05bd4b446c6ab23ba2e01f72fba4d6ca))
|
|
15
|
+
* **card-tabs:** fix color dot ([596af8c](https://github.com/Synerise/synerise-design/commit/596af8c7e4c6e64ac187e61ee50f81bbff9de581))
|
|
16
|
+
* **card-tabs:** fix knobs and styles in inline edit ([ae7bb6a](https://github.com/Synerise/synerise-design/commit/ae7bb6a82a88845bb540603cc580db2111a785c3))
|
|
17
|
+
* **card-tabs:** fix styles ([f81193a](https://github.com/Synerise/synerise-design/commit/f81193a5ce6b4a06a7905f8f9da7ea94a6f08061))
|
|
18
|
+
* **card-tabs:** update documantation ([37c2f87](https://github.com/Synerise/synerise-design/commit/37c2f87a6fcffdee2f89263be007f2ba9d9d5868))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [0.8.74](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-tabs@0.8.73...@synerise/ds-card-tabs@0.8.74) (2021-10-19)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @synerise/ds-card-tabs
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## [0.8.73](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-tabs@0.8.72...@synerise/ds-card-tabs@0.8.73) (2021-09-21)
|
|
33
|
+
|
|
34
|
+
**Note:** Version bump only for package @synerise/ds-card-tabs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## [0.8.72](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-tabs@0.8.71...@synerise/ds-card-tabs@0.8.72) (2021-09-15)
|
|
41
|
+
|
|
42
|
+
**Note:** Version bump only for package @synerise/ds-card-tabs
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
6
48
|
## [0.8.71](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-tabs@0.8.70...@synerise/ds-card-tabs@0.8.71) (2021-09-09)
|
|
7
49
|
|
|
8
50
|
**Note:** Version bump only for package @synerise/ds-card-tabs
|
package/README.md
CHANGED
|
@@ -99,6 +99,7 @@ import CardTabs from '@synerise/ds-card-tabs'
|
|
|
99
99
|
| onChangeName | Callback fired when the edit name input blur | (id: number, newName: string) | - |
|
|
100
100
|
| texts | Translations of CrudButtons tooltips | CardTabTexts | - |
|
|
101
101
|
| color | Color of CardTab | `red`/ `green`/ `grey`/ `yellow`/ `blue`/ `pink`/ `mars`/ `orange`/ `fern`/ `cyan`/ `purple`/ `violet` | `yellow` |
|
|
102
|
+
| colorDot | single color dot | React.ReactNode | - |
|
|
102
103
|
|
|
103
104
|
#### CardTabTexts
|
|
104
105
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { CardTabProps } from './CardTab.types';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<CardTabProps, "color" | "id" | "name" | "draggable" | "prefix" | "disabled" | "invalidName" | "active" | "invalid" | "greyBackground" | "tag" | "prefixIcon" | "onDuplicateTab" | "onRemoveTab" | "texts" | "suffixIcon" | "onChangeName" | "onSelectTab"> & {
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<CardTabProps, "color" | "id" | "name" | "draggable" | "prefix" | "disabled" | "invalidName" | "active" | "invalid" | "greyBackground" | "tag" | "prefixIcon" | "colorDot" | "onDuplicateTab" | "onRemoveTab" | "texts" | "suffixIcon" | "onChangeName" | "onSelectTab"> & {
|
|
4
4
|
forwardedRef?: ((instance: any) => void) | React.RefObject<any> | null | undefined;
|
|
5
5
|
} & React.RefAttributes<any>> & {
|
|
6
6
|
WrappedComponent: React.ComponentType<CardTabProps>;
|
package/dist/CardTab/CardTab.js
CHANGED
|
@@ -20,6 +20,7 @@ import * as React from 'react';
|
|
|
20
20
|
import Icon from '@synerise/ds-icon';
|
|
21
21
|
import InlineEdit from '@synerise/ds-inline-edit/dist/InlineEdit';
|
|
22
22
|
import { injectIntl } from 'react-intl';
|
|
23
|
+
import Tooltip from '@synerise/ds-tooltip';
|
|
23
24
|
import * as S from './CardTab.styles';
|
|
24
25
|
import CardTabPrefix from './CardTabPrefix/CardTabPrefix';
|
|
25
26
|
import CardTabActions from './CardTabActions/CardTabActions';
|
|
@@ -44,7 +45,8 @@ var CardTab = function CardTab(_ref) {
|
|
|
44
45
|
onRemoveTab = _ref.onRemoveTab,
|
|
45
46
|
texts = _ref.texts,
|
|
46
47
|
_ref$color = _ref.color,
|
|
47
|
-
color = _ref$color === void 0 ? 'yellow' : _ref$color
|
|
48
|
+
color = _ref$color === void 0 ? 'yellow' : _ref$color,
|
|
49
|
+
colorDot = _ref.colorDot;
|
|
48
50
|
|
|
49
51
|
var _React$useState = React.useState(false),
|
|
50
52
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -125,6 +127,7 @@ var CardTab = function CardTab(_ref) {
|
|
|
125
127
|
"data-id": id,
|
|
126
128
|
"data-testid": "card-tab-container"
|
|
127
129
|
}, React.createElement(CardTabPrefix, {
|
|
130
|
+
colorDot: colorDot,
|
|
128
131
|
draggable: draggable,
|
|
129
132
|
prefixIcon: prefixIcon,
|
|
130
133
|
prefix: prefix,
|
|
@@ -144,18 +147,20 @@ var CardTab = function CardTab(_ref) {
|
|
|
144
147
|
onChange: handleChangeName
|
|
145
148
|
},
|
|
146
149
|
"data-testid": "card-tab-edit-input"
|
|
147
|
-
}) : React.createElement(
|
|
150
|
+
}) : React.createElement(Tooltip, {
|
|
151
|
+
title: name
|
|
152
|
+
}, React.createElement(S.CardTabName, {
|
|
148
153
|
"data-testid": "card-tab-name"
|
|
149
|
-
}, name)), showCardActions() && React.createElement(CardTabActions, {
|
|
154
|
+
}, name))), showCardActions() && React.createElement(CardTabActions, {
|
|
150
155
|
enterEditNameMode: handleEditName,
|
|
151
156
|
changeNameAvailable: Boolean(onChangeName),
|
|
152
157
|
onDuplicateTab: handleDuplicate,
|
|
153
158
|
onRemoveTab: handleRemove,
|
|
154
159
|
texts: getTexts
|
|
155
|
-
}), suffixIcon && React.createElement(Icon, {
|
|
160
|
+
}), suffixIcon && React.createElement(S.CardSuffixWrapper, null, React.createElement(Icon, {
|
|
156
161
|
className: "ds-card-tabs__suffix-icon",
|
|
157
162
|
component: suffixIcon
|
|
158
|
-
}));
|
|
163
|
+
})));
|
|
159
164
|
};
|
|
160
165
|
|
|
161
166
|
export default injectIntl(CardTab);
|
|
@@ -6,13 +6,19 @@ declare type CardTabContainerProps = {
|
|
|
6
6
|
color: string;
|
|
7
7
|
disabled: boolean;
|
|
8
8
|
edited: boolean;
|
|
9
|
+
draggable?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare const CardTabSuffix: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
12
|
export declare const CardTabName: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
13
|
+
export declare const CardSuffixWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
12
14
|
export declare const CardTabLabel: import("styled-components").StyledComponent<"span", any, {
|
|
13
15
|
invalidName: boolean;
|
|
14
16
|
}, never>;
|
|
15
17
|
export declare const CardTabTag: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const CardDotPrefix: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
|
+
export declare const CardDot: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
20
|
export declare const CardTabPrefix: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
21
|
+
export declare const CardDragPrefix: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
|
+
export declare const CardIconPrefix: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
23
|
export declare const CardTabContainer: import("styled-components").StyledComponent<"div", any, CardTabContainerProps, never>;
|
|
18
24
|
export {};
|
|
@@ -27,9 +27,13 @@ export var CardTabName = styled.span.withConfig({
|
|
|
27
27
|
displayName: "CardTabstyles__CardTabName",
|
|
28
28
|
componentId: "sc-1n86s98-1"
|
|
29
29
|
})(["max-width:100%;display:inline-block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;"]);
|
|
30
|
+
export var CardSuffixWrapper = styled.span.withConfig({
|
|
31
|
+
displayName: "CardTabstyles__CardSuffixWrapper",
|
|
32
|
+
componentId: "sc-1n86s98-2"
|
|
33
|
+
})(["display:none;"]);
|
|
30
34
|
export var CardTabLabel = styled.span.withConfig({
|
|
31
35
|
displayName: "CardTabstyles__CardTabLabel",
|
|
32
|
-
componentId: "sc-1n86s98-
|
|
36
|
+
componentId: "sc-1n86s98-3"
|
|
33
37
|
})(["", ";color:", ";line-height:20px;position:relative;font-size:14px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:1;display:flex;align-items:center;justify-content:flex-start;&&&{", "{background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;background-image:", ";}}", "{input{font-weight:500;font-size:14px;line-height:20px;color:", ";background-image:linear-gradient( to right,", " 0%,", " 33%,rgba(255,255,255,0) 34%,rgba(255,255,255,0) 100% );}}"], macro.h300, function (props) {
|
|
34
38
|
return props.theme.palette['grey-600'];
|
|
35
39
|
}, CardTabName, function (props) {
|
|
@@ -43,130 +47,194 @@ export var CardTabLabel = styled.span.withConfig({
|
|
|
43
47
|
});
|
|
44
48
|
export var CardTabTag = styled.div.withConfig({
|
|
45
49
|
displayName: "CardTabstyles__CardTabTag",
|
|
46
|
-
componentId: "sc-1n86s98-
|
|
50
|
+
componentId: "sc-1n86s98-4"
|
|
47
51
|
})(["", " color:", ";display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:3px;"], macro.h200, function (_ref5) {
|
|
48
52
|
var theme = _ref5.theme;
|
|
49
53
|
return theme.palette.white;
|
|
50
54
|
});
|
|
55
|
+
export var CardDotPrefix = styled.div.withConfig({
|
|
56
|
+
displayName: "CardTabstyles__CardDotPrefix",
|
|
57
|
+
componentId: "sc-1n86s98-5"
|
|
58
|
+
})(["", " color:", ";display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;"], macro.h200, function (_ref6) {
|
|
59
|
+
var theme = _ref6.theme;
|
|
60
|
+
return theme.palette.white;
|
|
61
|
+
});
|
|
62
|
+
export var CardDot = styled.div.withConfig({
|
|
63
|
+
displayName: "CardTabstyles__CardDot",
|
|
64
|
+
componentId: "sc-1n86s98-6"
|
|
65
|
+
})(["", " display:flex;align-items:center;justify-content:center;width:8px;height:8px;border-radius:50%;"], macro.h200);
|
|
51
66
|
export var CardTabPrefix = styled.div.withConfig({
|
|
52
67
|
displayName: "CardTabstyles__CardTabPrefix",
|
|
53
|
-
componentId: "sc-1n86s98-
|
|
68
|
+
componentId: "sc-1n86s98-7"
|
|
54
69
|
})(["display:flex;align-items:center;justify-content:center;width:24px;height:24px;margin-right:12px;"]);
|
|
70
|
+
export var CardDragPrefix = styled.div.withConfig({
|
|
71
|
+
displayName: "CardTabstyles__CardDragPrefix",
|
|
72
|
+
componentId: "sc-1n86s98-8"
|
|
73
|
+
})(["display:none;"]);
|
|
74
|
+
export var CardIconPrefix = styled.div.withConfig({
|
|
75
|
+
displayName: "CardTabstyles__CardIconPrefix",
|
|
76
|
+
componentId: "sc-1n86s98-9"
|
|
77
|
+
})(["display:flex;"]);
|
|
55
78
|
export var CardTabContainer = styled.div.withConfig({
|
|
56
79
|
displayName: "CardTabstyles__CardTabContainer",
|
|
57
|
-
componentId: "sc-1n86s98-
|
|
58
|
-
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;padding:12px;width:180px;height:48px;user-select:none;background-color:", ";box-shadow:", ";border-radius:3px;border-width:1px;border-color:", ";border-style:solid;pointer-events:", ";", "{background-color:", ";color:", ";}&:hover{cursor:pointer;background-color:", ";", "{display:", ";}", "{color:", ";}", "{background-color:", ";color:", ";}", "{svg{color:", "
|
|
59
|
-
var theme =
|
|
60
|
-
active =
|
|
61
|
-
invalid =
|
|
62
|
-
color =
|
|
63
|
-
greyBackground =
|
|
64
|
-
edited =
|
|
80
|
+
componentId: "sc-1n86s98-10"
|
|
81
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;padding:12px;width:180px;height:48px;user-select:none;background-color:", ";box-shadow:", ";border-radius:3px;border-width:1px;border-color:", ";border-style:solid;pointer-events:", ";", "{background-color:", ";color:", ";}", "{background-color:", ";}", "{height:", ";width:", ";border-width:", ";border-color:", ";border-style:solid;}&:hover{cursor:pointer;box-shadow:", ";background-color:", ";", "{display:", ";}", "{display:", ";}", "{color:", ";}", "{background-color:", ";color:", ";display:none;}", "{svg{color:", ";fill:", ";}}", "{display:flex;svg{color:", ";fill:", " !important;}}", "{display:none;}", "{display:none;svg{color:", ";fill:", ";}}.ds-card-tabs__suffix-icon{svg{color:", ";fill:", ";}}}&.pressed{background-color:", ";}", "{color:", ";opacity:", ";}.ds-card-tabs__suffix-icon{svg{color:", ";fill:", ";}opacity:", ";}", "{opacity:", ";.ds-card-tabs__handle-icon{svg{color:", ";fill:", ";}}svg{color:", ";fill:", ";}", "{opacity:", ";}}"], function (_ref7) {
|
|
82
|
+
var theme = _ref7.theme,
|
|
83
|
+
active = _ref7.active,
|
|
84
|
+
invalid = _ref7.invalid,
|
|
85
|
+
color = _ref7.color,
|
|
86
|
+
greyBackground = _ref7.greyBackground,
|
|
87
|
+
edited = _ref7.edited;
|
|
65
88
|
if (invalid && active) return theme.palette['red-600'];
|
|
66
|
-
if (active && !edited) return theme.palette["".concat(color
|
|
89
|
+
if (active && !edited) return theme.palette["".concat(color)];
|
|
67
90
|
if (greyBackground) return theme.palette.white;
|
|
68
91
|
return theme.palette['grey-050'];
|
|
69
|
-
}, function (_ref7) {
|
|
70
|
-
var greyBackground = _ref7.greyBackground;
|
|
71
|
-
return greyBackground ? '0 4px 12px 0 rgba(35, 41, 54, 0.04)' : '0';
|
|
72
92
|
}, function (_ref8) {
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
invalid = _ref8.invalid,
|
|
76
|
-
color = _ref8.color,
|
|
77
|
-
edited = _ref8.edited;
|
|
78
|
-
if (invalid) return theme.palette['red-600'];
|
|
79
|
-
return getColor(active && !edited, theme.palette["".concat(color, "-600")], theme.palette['grey-050']);
|
|
93
|
+
var greyBackground = _ref8.greyBackground;
|
|
94
|
+
return greyBackground ? '0 4px 12px 0 rgba(35, 41, 54, 0.04)' : '0';
|
|
80
95
|
}, function (_ref9) {
|
|
81
|
-
var
|
|
96
|
+
var theme = _ref9.theme,
|
|
97
|
+
active = _ref9.active,
|
|
98
|
+
invalid = _ref9.invalid,
|
|
99
|
+
color = _ref9.color,
|
|
100
|
+
edited = _ref9.edited;
|
|
101
|
+
if (invalid) return theme.palette['red-600'];
|
|
102
|
+
if (edited) return theme.palette['blue-600'];
|
|
103
|
+
return getColor(active && !edited, theme.palette["".concat(color)], theme.palette['grey-300']);
|
|
104
|
+
}, function (_ref10) {
|
|
105
|
+
var disabled = _ref10.disabled;
|
|
82
106
|
return disabled ? 'none' : 'all';
|
|
83
|
-
}, CardTabTag, function (
|
|
84
|
-
var theme = _ref10.theme,
|
|
85
|
-
active = _ref10.active,
|
|
86
|
-
color = _ref10.color,
|
|
87
|
-
edited = _ref10.edited;
|
|
88
|
-
return getColor(active && !edited, theme.palette.white, theme.palette["".concat(color, "-600")]);
|
|
89
|
-
}, function (_ref11) {
|
|
107
|
+
}, CardTabTag, function (_ref11) {
|
|
90
108
|
var theme = _ref11.theme,
|
|
91
109
|
active = _ref11.active,
|
|
92
110
|
color = _ref11.color,
|
|
93
111
|
edited = _ref11.edited;
|
|
94
|
-
return getColor(active && !edited, theme.palette["".concat(color
|
|
112
|
+
return getColor(active && !edited, theme.palette.white, theme.palette["".concat(color)]);
|
|
95
113
|
}, function (_ref12) {
|
|
96
114
|
var theme = _ref12.theme,
|
|
97
|
-
|
|
115
|
+
active = _ref12.active,
|
|
116
|
+
color = _ref12.color,
|
|
117
|
+
edited = _ref12.edited;
|
|
118
|
+
return getColor(active && !edited, theme.palette["".concat(color)], theme.palette.white);
|
|
119
|
+
}, CardDot, function (_ref13) {
|
|
120
|
+
var theme = _ref13.theme,
|
|
121
|
+
active = _ref13.active,
|
|
122
|
+
color = _ref13.color,
|
|
123
|
+
edited = _ref13.edited,
|
|
124
|
+
invalid = _ref13.invalid;
|
|
125
|
+
if (active && invalid) return theme.palette["".concat(color)];
|
|
126
|
+
return getColor(active && !edited, 'transparent', theme.palette["".concat(color)]);
|
|
127
|
+
}, CardDotPrefix, function (_ref14) {
|
|
128
|
+
var active = _ref14.active,
|
|
129
|
+
edited = _ref14.edited;
|
|
130
|
+
return active && !edited ? '12px' : '24px';
|
|
131
|
+
}, function (_ref15) {
|
|
132
|
+
var active = _ref15.active,
|
|
133
|
+
edited = _ref15.edited;
|
|
134
|
+
return active && !edited ? '12px' : '24px';
|
|
135
|
+
}, function (_ref16) {
|
|
136
|
+
var active = _ref16.active,
|
|
137
|
+
edited = _ref16.edited;
|
|
138
|
+
return active && !edited ? '2px' : '0px';
|
|
139
|
+
}, function (_ref17) {
|
|
140
|
+
var theme = _ref17.theme,
|
|
141
|
+
active = _ref17.active,
|
|
142
|
+
edited = _ref17.edited;
|
|
143
|
+
return active && !edited ? theme.palette.white : 'none';
|
|
144
|
+
}, function (_ref18) {
|
|
145
|
+
var greyBackground = _ref18.greyBackground,
|
|
146
|
+
theme = _ref18.theme;
|
|
147
|
+
return greyBackground ? '0px 10px 13px -7px #000000,-25px 20px 19px -16px rgba(0,0,0,0)' : "0px 4px 8px 5px ".concat(theme.palette["grey-050"]);
|
|
148
|
+
}, function (_ref19) {
|
|
149
|
+
var theme = _ref19.theme,
|
|
150
|
+
greyBackground = _ref19.greyBackground;
|
|
98
151
|
return greyBackground ? theme.palette.white : theme.palette['grey-050'];
|
|
99
|
-
}, CardTabSuffix, function (
|
|
100
|
-
var edited =
|
|
152
|
+
}, CardTabSuffix, function (_ref20) {
|
|
153
|
+
var edited = _ref20.edited;
|
|
154
|
+
return edited ? 'none' : 'flex';
|
|
155
|
+
}, CardSuffixWrapper, function (_ref21) {
|
|
156
|
+
var edited = _ref21.edited;
|
|
101
157
|
return edited ? 'none' : 'flex';
|
|
102
|
-
}, CardTabLabel, function (
|
|
103
|
-
var theme =
|
|
104
|
-
invalidName =
|
|
158
|
+
}, CardTabLabel, function (_ref22) {
|
|
159
|
+
var theme = _ref22.theme,
|
|
160
|
+
invalidName = _ref22.invalidName;
|
|
105
161
|
return invalidName ? theme.palette['red-600'] : theme.palette['grey-800'];
|
|
106
|
-
}, CardTabTag, function (
|
|
107
|
-
var theme =
|
|
108
|
-
color =
|
|
109
|
-
return theme.palette["".concat(color
|
|
110
|
-
}, function (
|
|
111
|
-
var theme =
|
|
162
|
+
}, CardTabTag, function (_ref23) {
|
|
163
|
+
var theme = _ref23.theme,
|
|
164
|
+
color = _ref23.color;
|
|
165
|
+
return theme.palette["".concat(color)];
|
|
166
|
+
}, function (_ref24) {
|
|
167
|
+
var theme = _ref24.theme;
|
|
112
168
|
return theme.palette.white;
|
|
113
|
-
}, CardTabPrefix, function (
|
|
114
|
-
var theme =
|
|
169
|
+
}, CardTabPrefix, function (_ref25) {
|
|
170
|
+
var theme = _ref25.theme;
|
|
115
171
|
return theme.palette['grey-600'];
|
|
116
|
-
}, function (
|
|
117
|
-
var theme =
|
|
172
|
+
}, function (_ref26) {
|
|
173
|
+
var theme = _ref26.theme;
|
|
118
174
|
return theme.palette['grey-600'];
|
|
119
|
-
}, function (
|
|
120
|
-
var theme =
|
|
175
|
+
}, CardDragPrefix, function (_ref27) {
|
|
176
|
+
var theme = _ref27.theme;
|
|
177
|
+
return theme.palette['grey-600'];
|
|
178
|
+
}, function (_ref28) {
|
|
179
|
+
var theme = _ref28.theme;
|
|
180
|
+
return theme.palette['grey-600'];
|
|
181
|
+
}, CardDotPrefix, CardIconPrefix, function (_ref29) {
|
|
182
|
+
var theme = _ref29.theme;
|
|
183
|
+
return theme.palette['grey-600'];
|
|
184
|
+
}, function (_ref30) {
|
|
185
|
+
var theme = _ref30.theme;
|
|
121
186
|
return theme.palette['grey-600'];
|
|
122
|
-
}, function (
|
|
123
|
-
var theme =
|
|
187
|
+
}, function (_ref31) {
|
|
188
|
+
var theme = _ref31.theme;
|
|
189
|
+
return theme.palette['grey-600'];
|
|
190
|
+
}, function (_ref32) {
|
|
191
|
+
var theme = _ref32.theme;
|
|
124
192
|
return theme.palette['grey-600'];
|
|
125
|
-
}, function (
|
|
126
|
-
var theme =
|
|
127
|
-
greyBackground =
|
|
193
|
+
}, function (_ref33) {
|
|
194
|
+
var theme = _ref33.theme,
|
|
195
|
+
greyBackground = _ref33.greyBackground;
|
|
128
196
|
return !greyBackground ? theme.palette['grey-100'] : theme.palette.white;
|
|
129
|
-
}, CardTabLabel, function (
|
|
130
|
-
var theme =
|
|
131
|
-
active =
|
|
132
|
-
invalidName =
|
|
197
|
+
}, CardTabLabel, function (_ref34) {
|
|
198
|
+
var theme = _ref34.theme,
|
|
199
|
+
active = _ref34.active,
|
|
200
|
+
invalidName = _ref34.invalidName;
|
|
133
201
|
if (invalidName) return theme.palette['red-600'];
|
|
134
202
|
if (active) return theme.palette.white;
|
|
135
203
|
return theme.palette['grey-600'];
|
|
136
|
-
}, function (
|
|
137
|
-
var disabled =
|
|
204
|
+
}, function (_ref35) {
|
|
205
|
+
var disabled = _ref35.disabled;
|
|
138
206
|
return disabled ? 0.4 : 1;
|
|
139
|
-
}, function (
|
|
140
|
-
var theme =
|
|
141
|
-
active =
|
|
207
|
+
}, function (_ref36) {
|
|
208
|
+
var theme = _ref36.theme,
|
|
209
|
+
active = _ref36.active;
|
|
142
210
|
return getColor(active, theme.palette.white, theme.palette['grey-600']);
|
|
143
|
-
}, function (
|
|
144
|
-
var theme =
|
|
145
|
-
active =
|
|
211
|
+
}, function (_ref37) {
|
|
212
|
+
var theme = _ref37.theme,
|
|
213
|
+
active = _ref37.active;
|
|
146
214
|
return getColor(active, theme.palette.white, theme.palette['grey-600']);
|
|
147
|
-
}, function (
|
|
148
|
-
var disabled =
|
|
215
|
+
}, function (_ref38) {
|
|
216
|
+
var disabled = _ref38.disabled;
|
|
149
217
|
return disabled ? 0.4 : 1;
|
|
150
|
-
}, CardTabPrefix, function (
|
|
151
|
-
var disabled =
|
|
218
|
+
}, CardTabPrefix, function (_ref39) {
|
|
219
|
+
var disabled = _ref39.disabled;
|
|
152
220
|
return disabled ? 0.4 : 1;
|
|
153
|
-
}, function (
|
|
154
|
-
var theme =
|
|
155
|
-
active =
|
|
221
|
+
}, function (_ref40) {
|
|
222
|
+
var theme = _ref40.theme,
|
|
223
|
+
active = _ref40.active;
|
|
156
224
|
return getColor(active, theme.palette.white, theme.palette['grey-400']);
|
|
157
|
-
}, function (
|
|
158
|
-
var theme =
|
|
159
|
-
active =
|
|
225
|
+
}, function (_ref41) {
|
|
226
|
+
var theme = _ref41.theme,
|
|
227
|
+
active = _ref41.active;
|
|
160
228
|
return getColor(active, theme.palette.white, theme.palette['grey-400']);
|
|
161
|
-
}, function (
|
|
162
|
-
var theme =
|
|
163
|
-
active =
|
|
229
|
+
}, function (_ref42) {
|
|
230
|
+
var theme = _ref42.theme,
|
|
231
|
+
active = _ref42.active;
|
|
164
232
|
return getColor(active, theme.palette.white, theme.palette['grey-600']);
|
|
165
|
-
}, function (
|
|
166
|
-
var theme =
|
|
167
|
-
active =
|
|
233
|
+
}, function (_ref43) {
|
|
234
|
+
var theme = _ref43.theme,
|
|
235
|
+
active = _ref43.active;
|
|
168
236
|
return getColor(active, theme.palette.white, theme.palette['grey-600']);
|
|
169
|
-
}, CardTabSuffix, function (
|
|
170
|
-
var disabled =
|
|
237
|
+
}, CardTabSuffix, function (_ref44) {
|
|
238
|
+
var disabled = _ref44.disabled;
|
|
171
239
|
return disabled ? 0.4 : 1;
|
|
172
240
|
});
|
|
@@ -2,7 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { IntlShape } from 'react-intl';
|
|
3
3
|
export declare enum prefixType {
|
|
4
4
|
TAG = 0,
|
|
5
|
-
ICON = 1
|
|
5
|
+
ICON = 1,
|
|
6
|
+
DOT = 2
|
|
6
7
|
}
|
|
7
8
|
export declare type Color = 'red' | 'green' | 'grey' | 'yellow' | 'blue' | 'pink' | 'mars' | 'orange' | 'fern' | 'cyan' | 'purple' | 'violet';
|
|
8
9
|
export declare type CardTabTexts = {
|
|
@@ -16,6 +17,7 @@ export interface CardTabProps {
|
|
|
16
17
|
name: string;
|
|
17
18
|
tag: string;
|
|
18
19
|
prefix: prefixType;
|
|
20
|
+
colorDot: React.ReactNode;
|
|
19
21
|
color?: Color;
|
|
20
22
|
active?: boolean;
|
|
21
23
|
draggable?: boolean;
|
|
@@ -9,18 +9,22 @@ var CardTabPrefix = function CardTabPrefix(_ref) {
|
|
|
9
9
|
var prefix = _ref.prefix,
|
|
10
10
|
draggable = _ref.draggable,
|
|
11
11
|
tag = _ref.tag,
|
|
12
|
-
prefixIcon = _ref.prefixIcon
|
|
12
|
+
prefixIcon = _ref.prefixIcon,
|
|
13
|
+
colorDot = _ref.colorDot;
|
|
13
14
|
return React.createElement(S.CardTabPrefix, {
|
|
14
15
|
"data-testid": "card-tab-prefix"
|
|
15
|
-
},
|
|
16
|
+
}, prefix === prefixType.TAG && tag && React.createElement(S.CardTabTag, {
|
|
17
|
+
draggable: draggable,
|
|
16
18
|
"data-testid": "card-tab-tag"
|
|
17
|
-
}, tag),
|
|
19
|
+
}, tag), prefix === prefixType.ICON && prefixIcon && React.createElement(S.CardIconPrefix, null, React.createElement(Icon, {
|
|
18
20
|
component: prefixIcon,
|
|
19
21
|
color: theme.palette['grey-600']
|
|
20
|
-
}),
|
|
22
|
+
})), prefix === prefixType.DOT && colorDot && React.createElement(S.CardDotPrefix, {
|
|
23
|
+
"data-testid": "card-dot-tag"
|
|
24
|
+
}, colorDot), draggable && React.createElement(S.CardDragPrefix, null, React.createElement(Icon, {
|
|
21
25
|
className: "ds-card-tabs__handle-icon",
|
|
22
26
|
component: React.createElement(DragHandleM, null)
|
|
23
|
-
}));
|
|
27
|
+
}), ' '));
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
export default CardTabPrefix;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const COLORS_TABS: string[];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
2
|
+
export var COLORS_TABS = ['blue-600', 'green-600', 'mars-600', 'purple-600', 'cyan-600', 'yellow-600', 'violet-600', 'blue-700', 'green-700', 'mars-700', 'purple-700', 'cyan-700', 'yellow-700', 'violet-700', 'blue-500', 'green-500', 'mars-500', 'purple-500', 'cyan-500', 'yellow-500', 'violet-500'];
|
package/dist/CardTabs.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2
4
|
|
|
3
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -8,6 +10,13 @@ import * as React from 'react';
|
|
|
8
10
|
import { ReactSortable } from 'react-sortablejs-typescript';
|
|
9
11
|
import Button from '@synerise/ds-button';
|
|
10
12
|
import * as S from './CardTabs.styles';
|
|
13
|
+
import { COLORS_TABS } from './CardTab/ColorsTabs';
|
|
14
|
+
var SORTABLE_CONFIG = {
|
|
15
|
+
ghostClass: 'sortable-card-ghost-element',
|
|
16
|
+
className: 'sortable-card',
|
|
17
|
+
animation: 150,
|
|
18
|
+
group: 'column-manager'
|
|
19
|
+
};
|
|
11
20
|
|
|
12
21
|
var CardTabs = function CardTabs(_ref) {
|
|
13
22
|
var className = _ref.className,
|
|
@@ -23,19 +32,28 @@ var CardTabs = function CardTabs(_ref) {
|
|
|
23
32
|
}));
|
|
24
33
|
};
|
|
25
34
|
|
|
35
|
+
var renderChildren = function renderChildren() {
|
|
36
|
+
return React.Children.map(children, function (child, i) {
|
|
37
|
+
var colorTabs = React.cloneElement(child, {
|
|
38
|
+
color: COLORS_TABS[i % COLORS_TABS.length]
|
|
39
|
+
});
|
|
40
|
+
return colorTabs;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
26
44
|
return React.createElement(S.CardTabsContainer, {
|
|
27
45
|
className: "ds-card-tabs ".concat(className || ''),
|
|
28
46
|
"data-testid": "card-tabs-container"
|
|
29
47
|
}, onChangeOrder ? React.createElement("div", {
|
|
30
48
|
"data-testid": "card-tabs-sortable"
|
|
31
|
-
}, React.createElement(ReactSortable, {
|
|
49
|
+
}, React.createElement(ReactSortable, _extends({}, SORTABLE_CONFIG, {
|
|
32
50
|
className: "ds-card-tags-sortable",
|
|
33
51
|
list: children,
|
|
34
52
|
setList: handleChangeOrder
|
|
35
|
-
},
|
|
53
|
+
}), renderChildren())) : React.createElement("div", {
|
|
36
54
|
className: "ds-card-tags-sortable",
|
|
37
55
|
"data-testid": "card-tabs-static"
|
|
38
|
-
},
|
|
56
|
+
}, renderChildren()), onAddTab && React.createElement("span", {
|
|
39
57
|
"data-testid": "card-tabs-add-button"
|
|
40
58
|
}, React.createElement(Button.Creator, {
|
|
41
59
|
disabled: !!maxTabsCount && React.Children.toArray(children).length >= maxTabsCount,
|
package/dist/CardTabs.styles.js
CHANGED
|
@@ -4,4 +4,10 @@ import { CardTabContainer } from './CardTab/CardTab.styles'; // eslint-disable-n
|
|
|
4
4
|
export var CardTabsContainer = styled.div.withConfig({
|
|
5
5
|
displayName: "CardTabsstyles__CardTabsContainer",
|
|
6
6
|
componentId: "sc-1uu9dja-0"
|
|
7
|
-
})(["display:flex;flex-direction:row;algin-items:flex-start;justify-content:flex-start;width:100%;", "{margin-right:
|
|
7
|
+
})(["display:flex;flex-direction:row;algin-items:flex-start;justify-content:flex-start;width:100%;", "{margin-right:12px;margin-bottom:24px;}.ds-card-tags-sortable{display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;flex-wrap:wrap;}.sortable-chosen{cursor:grabbing;background-color:", ";opacity:1;}.sortable-drag{opacity:1 !important;box-shadow:0 16px 32px 0 rgba(35,41,54,0.1);}.sortable-card-ghost-element{background-color:", ";&:hover{background-color:", ";}opacity:1;cursor:grabbing;*{visibility:hidden;}}"], CardTabContainer, function (props) {
|
|
8
|
+
return props.theme.palette.white;
|
|
9
|
+
}, function (props) {
|
|
10
|
+
return props.theme.palette['blue-300'];
|
|
11
|
+
}, function (props) {
|
|
12
|
+
return props.theme.palette['blue-050'];
|
|
13
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-card-tabs",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.75",
|
|
4
4
|
"description": "CardTabs UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
],
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-button": "^0.
|
|
36
|
-
"@synerise/ds-cruds": "^0.2.
|
|
37
|
-
"@synerise/ds-inline-edit": "^0.4.
|
|
38
|
-
"@synerise/ds-typography": "^0.11.
|
|
35
|
+
"@synerise/ds-button": "^0.14.0",
|
|
36
|
+
"@synerise/ds-cruds": "^0.2.48",
|
|
37
|
+
"@synerise/ds-inline-edit": "^0.4.37",
|
|
38
|
+
"@synerise/ds-typography": "^0.11.9",
|
|
39
39
|
"react-sortablejs-typescript": "2.0.3",
|
|
40
40
|
"sortablejs": "^1.10.1"
|
|
41
41
|
},
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/lodash": "4.14.149"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "b69adf958dccdf8cc697fbba1a47acc96218f40e"
|
|
51
51
|
}
|