@synerise/ds-card-tabs 0.11.6 → 0.12.2

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 CHANGED
@@ -3,6 +3,45 @@
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.12.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-tabs@0.12.1...@synerise/ds-card-tabs@0.12.2) (2022-04-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **condition:** rules-of-hooks dependencies ([10e573e](https://github.com/Synerise/synerise-design/commit/10e573e018ca7e2f69f3f317f35d51eace89ded8))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.12.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-tabs@0.12.0...@synerise/ds-card-tabs@0.12.1) (2022-04-12)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * fix filter dropdowns ([eaab107](https://github.com/Synerise/synerise-design/commit/eaab107b6dca7401a17c2e36806febd11edc677b))
23
+
24
+
25
+
26
+
27
+
28
+ # [0.12.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-tabs@0.11.6...@synerise/ds-card-tabs@0.12.0) (2022-04-08)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **step-card:** hide top duplicate and delete action buttons ([9c7bd51](https://github.com/Synerise/synerise-design/commit/9c7bd51c687ebad7c0474b25cb07e6a5ea478783))
34
+
35
+
36
+ ### Features
37
+
38
+ * **card-tabs:** disable duplication when limit exceeded (cardTab) ([e83cedb](https://github.com/Synerise/synerise-design/commit/e83cedb0f8a975fce5dd7c181d3811715ac66a9f))
39
+ * **card-tabs:** onDuplicate, onRemove accept undefined; stories, tests ([6cfd41d](https://github.com/Synerise/synerise-design/commit/6cfd41dd6db00a81428d92d024a060cc37c32239))
40
+
41
+
42
+
43
+
44
+
6
45
  ## [0.11.6](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-tabs@0.11.5...@synerise/ds-card-tabs@0.11.6) (2022-04-05)
7
46
 
8
47
  **Note:** Version bump only for package @synerise/ds-card-tabs
@@ -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" | "colorDot" | "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" | "onChangeName" | "onDuplicateTab" | "onRemoveTab" | "texts" | "suffixIcon" | "onSelectTab"> & {
4
4
  forwardedRef?: ((instance: any) => void) | React.RefObject<any> | null | undefined;
5
5
  } & React.RefAttributes<any>> & {
6
6
  WrappedComponent: React.ComponentType<CardTabProps>;
@@ -65,23 +65,42 @@ var CardTab = function CardTab(_ref) {
65
65
  !!event && event.stopPropagation();
66
66
  setEdited(true);
67
67
  }, [setEdited]);
68
- var handleChangeName = React.useCallback(function (event) {
69
- if (event) {
70
- var value = event.target.value;
71
- setEditedName(value);
68
+ var handleChangeName = React.useMemo(function () {
69
+ if (onChangeName === undefined) {
70
+ return undefined;
72
71
  }
73
- }, [setEditedName]);
72
+
73
+ return function (event) {
74
+ if (event) {
75
+ var nameValue = event.target.value;
76
+ setEditedName(nameValue);
77
+ onChangeName && onChangeName(id, nameValue);
78
+ }
79
+ };
80
+ }, [setEditedName, onChangeName, id]);
74
81
  var handleEditNameBlur = React.useCallback(function () {
75
82
  setEdited(false);
76
83
  onChangeName && onChangeName(id, editedName);
77
84
  }, [onChangeName, id, editedName]);
78
- var handleDuplicate = React.useCallback(function (event) {
79
- !!event && event.stopPropagation();
80
- onDuplicateTab && onDuplicateTab(id);
85
+ var handleDuplicate = React.useMemo(function () {
86
+ if (onDuplicateTab === undefined) {
87
+ return undefined;
88
+ }
89
+
90
+ return function (event) {
91
+ event && event.stopPropagation();
92
+ onDuplicateTab && onDuplicateTab(id);
93
+ };
81
94
  }, [id, onDuplicateTab]);
82
- var handleRemove = React.useCallback(function (event) {
83
- !!event && event.stopPropagation();
84
- onRemoveTab && onRemoveTab(id);
95
+ var handleRemove = React.useMemo(function () {
96
+ if (onRemoveTab === undefined) {
97
+ return undefined;
98
+ }
99
+
100
+ return function (event) {
101
+ event && event.stopPropagation();
102
+ onRemoveTab && onRemoveTab(id);
103
+ };
85
104
  }, [id, onRemoveTab]);
86
105
  var handleSelect = React.useCallback(function (event) {
87
106
  !!event && event.stopPropagation();
@@ -130,7 +149,9 @@ var CardTab = function CardTab(_ref) {
130
149
  value: editedName,
131
150
  name: "ds-card-tab-input-" + id,
132
151
  onBlur: handleEditNameBlur,
133
- onChange: handleChangeName
152
+ onChange: handleChangeName || function () {
153
+ return undefined;
154
+ }
134
155
  },
135
156
  "data-testid": "card-tab-edit-input"
136
157
  }) : /*#__PURE__*/React.createElement(Tooltip, {
@@ -138,8 +159,7 @@ var CardTab = function CardTab(_ref) {
138
159
  }, /*#__PURE__*/React.createElement(S.CardTabName, {
139
160
  "data-testid": "card-tab-name"
140
161
  }, name))), showCardActions() && /*#__PURE__*/React.createElement(CardTabActions, {
141
- enterEditNameMode: handleEditName,
142
- changeNameAvailable: Boolean(onChangeName),
162
+ onChangeName: handleEditName,
143
163
  onDuplicateTab: handleDuplicate,
144
164
  onRemoveTab: handleRemove,
145
165
  texts: getTexts
@@ -66,7 +66,7 @@ export var CardDot = styled.div.withConfig({
66
66
  export var CardTabPrefix = styled.div.withConfig({
67
67
  displayName: "CardTabstyles__CardTabPrefix",
68
68
  componentId: "sc-1n86s98-7"
69
- })(["display:flex;align-items:center;justify-content:center;width:24px;height:24px;margin-right:12px;"]);
69
+ })(["display:flex;align-items:center;justify-content:center;width:24px;height:24px;margin-right:16px;"]);
70
70
  export var CardDragPrefix = styled.div.withConfig({
71
71
  displayName: "CardTabstyles__CardDragPrefix",
72
72
  componentId: "sc-1n86s98-8"
@@ -3,7 +3,7 @@ import Cruds from '@synerise/ds-cruds';
3
3
  import * as S from '../CardTab.styles';
4
4
 
5
5
  var CardTabActions = function CardTabActions(_ref) {
6
- var changeNameAvailable = _ref.changeNameAvailable,
6
+ var onChangeName = _ref.onChangeName,
7
7
  enterEditNameMode = _ref.enterEditNameMode,
8
8
  onDuplicateTab = _ref.onDuplicateTab,
9
9
  onRemoveTab = _ref.onRemoveTab,
@@ -11,7 +11,7 @@ var CardTabActions = function CardTabActions(_ref) {
11
11
  return /*#__PURE__*/React.createElement(S.CardTabSuffix, {
12
12
  "data-testid": "card-tab-suffix"
13
13
  }, /*#__PURE__*/React.createElement(Cruds, {
14
- onEdit: changeNameAvailable ? enterEditNameMode : undefined,
14
+ onEdit: onChangeName != null ? onChangeName : enterEditNameMode,
15
15
  editTooltip: texts == null ? void 0 : texts.changeNameTooltip,
16
16
  onDuplicate: onDuplicateTab,
17
17
  duplicateTooltip: texts == null ? void 0 : texts.duplicateTooltip,
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { CardTabTexts } from '../CardTab.types';
3
3
  export interface Props {
4
- changeNameAvailable: boolean;
5
- enterEditNameMode: (event?: React.MouseEvent<HTMLElement>) => void;
4
+ onChangeName?: (event?: React.MouseEvent<HTMLElement>) => void;
5
+ /** @deprecated */
6
+ enterEditNameMode?: (event?: React.MouseEvent<HTMLElement>) => void;
6
7
  onDuplicateTab?: (event?: React.MouseEvent<HTMLElement>) => void;
7
8
  onRemoveTab?: (event?: React.MouseEvent<HTMLElement>) => void;
8
9
  texts?: CardTabTexts;
@@ -4,7 +4,7 @@ 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:12px;}.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) {
7
+ })(["display:flex;flex-direction:row;algin-items:flex-start;justify-content:flex-start;width:100%;", "{margin-right:12px;margin-bottom:16px;}.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
8
  return props.theme.palette.white;
9
9
  }, function (props) {
10
10
  return props.theme.palette['blue-300'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-card-tabs",
3
- "version": "0.11.6",
3
+ "version": "0.12.2",
4
4
  "description": "CardTabs UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -35,7 +35,7 @@
35
35
  "@synerise/ds-button": "^0.17.2",
36
36
  "@synerise/ds-cruds": "^0.3.9",
37
37
  "@synerise/ds-icon": "^0.49.0",
38
- "@synerise/ds-inline-edit": "^0.6.10",
38
+ "@synerise/ds-inline-edit": "^0.6.11",
39
39
  "@synerise/ds-typography": "^0.12.2",
40
40
  "react-sortablejs-typescript": "2.0.3",
41
41
  "sortablejs": "^1.10.1"
@@ -48,5 +48,5 @@
48
48
  "devDependencies": {
49
49
  "@types/lodash": "4.14.149"
50
50
  },
51
- "gitHead": "5793ce09feb88b36cc8ca1923ddfcb272b889cb0"
51
+ "gitHead": "78a3de75d8ec9c917d96c1b54c70d24f50dc8c7a"
52
52
  }