@synerise/ds-manageable-list 1.7.10 → 1.7.12
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 +8 -0
- package/README.md +7 -6
- package/dist/AddBlankItem/AddBlankItem.d.ts +2 -2
- package/dist/AddBlankItem/AddBlankItem.js +19 -22
- package/dist/AddBlankItem/AddBlankItem.styles.d.ts +2 -2
- package/dist/AddBlankItem/AddBlankItem.styles.js +9 -5
- package/dist/AddBlankItem/AddBlankItem.types.d.ts +1 -1
- package/dist/AddBlankItem/AddBlankItem.types.js +1 -1
- package/dist/AddItem/AddItem.d.ts +3 -3
- package/dist/AddItem/AddItem.js +14 -18
- package/dist/AddItem/AddItem.styles.d.ts +1 -1
- package/dist/AddItem/AddItem.styles.js +6 -3
- package/dist/AddItem/AddItem.types.d.ts +1 -1
- package/dist/AddItem/AddItem.types.js +1 -1
- package/dist/AddItemWithName/AddItemWithName.d.ts +2 -2
- package/dist/AddItemWithName/AddItemWithName.js +30 -43
- package/dist/AddItemWithName/AddItemWithName.styles.d.ts +2 -2
- package/dist/AddItemWithName/AddItemWithName.styles.js +9 -5
- package/dist/AddItemWithName/AddItemWithName.types.d.ts +1 -1
- package/dist/AddItemWithName/AddItemWithName.types.js +1 -1
- package/dist/Item/BlankItem/BlankItem.d.ts +2 -2
- package/dist/Item/BlankItem/BlankItem.js +43 -61
- package/dist/Item/BlankItem/BlankItem.styles.d.ts +4 -4
- package/dist/Item/BlankItem/BlankItem.styles.js +26 -21
- package/dist/Item/BlankItem/BlankItem.types.d.ts +3 -3
- package/dist/Item/BlankItem/BlankItem.types.js +1 -1
- package/dist/Item/ContentItem/ContentItem.d.ts +43 -43
- package/dist/Item/ContentItem/ContentItem.js +58 -99
- package/dist/Item/ContentItem/ContentItem.styles.d.ts +45 -45
- package/dist/Item/ContentItem/ContentItem.styles.js +76 -85
- package/dist/Item/ContentItem/ContentItem.types.d.ts +4 -4
- package/dist/Item/ContentItem/ContentItem.types.js +1 -1
- package/dist/Item/ContentItem/ContentItemHeader.d.ts +2 -2
- package/dist/Item/ContentItem/ContentItemHeader.js +88 -134
- package/dist/Item/DraggableItem.d.ts +2 -2
- package/dist/Item/DraggableItem.js +26 -27
- package/dist/Item/FilterItem/FilterItem.d.ts +43 -43
- package/dist/Item/FilterItem/FilterItem.js +74 -140
- package/dist/Item/FilterItem/FilterItem.styles.d.ts +3 -3
- package/dist/Item/FilterItem/FilterItem.styles.js +17 -27
- package/dist/Item/FilterItem/FilterItem.types.d.ts +2 -2
- package/dist/Item/FilterItem/FilterItem.types.js +1 -1
- package/dist/Item/Item.d.ts +2 -2
- package/dist/Item/Item.js +39 -90
- package/dist/Item/Item.styles.d.ts +9 -9
- package/dist/Item/Item.styles.js +50 -48
- package/dist/Item/Item.types.d.ts +1 -1
- package/dist/Item/Item.types.js +1 -1
- package/dist/Item/ItemActions/ItemActions.d.ts +2 -2
- package/dist/Item/ItemActions/ItemActions.js +41 -43
- package/dist/Item/ItemActions/ItemActions.styles.d.ts +1 -1
- package/dist/Item/ItemActions/ItemActions.styles.js +9 -7
- package/dist/Item/ItemActions/ItemActions.types.d.ts +2 -2
- package/dist/Item/ItemActions/ItemActions.types.js +1 -1
- package/dist/Item/ItemMeta/ItemMeta.d.ts +2 -2
- package/dist/Item/ItemMeta/ItemMeta.js +27 -22
- package/dist/Item/ItemMeta/ItemMeta.styles.d.ts +2 -2
- package/dist/Item/ItemMeta/ItemMeta.styles.js +9 -7
- package/dist/Item/ItemMeta/ItemMeta.types.js +1 -1
- package/dist/Item/ItemName/ItemName.d.ts +2 -2
- package/dist/Item/ItemName/ItemName.js +36 -55
- package/dist/Item/ItemName/ItemName.types.d.ts +2 -2
- package/dist/Item/ItemName/ItemName.types.js +1 -1
- package/dist/Item/ItemNameLarge/ItemNameLarge.d.ts +2 -2
- package/dist/Item/ItemNameLarge/ItemNameLarge.js +17 -13
- package/dist/Item/ItemNameLarge/ItemNameLarge.types.d.ts +1 -1
- package/dist/Item/ItemNameLarge/ItemNameLarge.types.js +1 -1
- package/dist/Item/SimpleItem/SimpleItem.d.ts +7 -7
- package/dist/Item/SimpleItem/SimpleItem.js +34 -56
- package/dist/Item/SimpleItem/SimpleItem.types.d.ts +2 -2
- package/dist/Item/SimpleItem/SimpleItem.types.js +1 -1
- package/dist/ManageableList.d.ts +4 -4
- package/dist/ManageableList.js +106 -164
- package/dist/ManageableList.styles.d.ts +2 -2
- package/dist/ManageableList.styles.js +12 -11
- package/dist/ManageableList.types.d.ts +2 -2
- package/dist/ManageableList.types.js +18 -14
- package/dist/hooks/useTexts.d.ts +1 -1
- package/dist/hooks/useTexts.js +31 -89
- package/dist/index.js +12 -5
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +21 -21
|
@@ -1,118 +1,109 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import Button from
|
|
3
|
-
import { Tag } from
|
|
4
|
-
import { ItemLabel } from
|
|
5
|
-
import { ItemActionsWrapper } from
|
|
6
|
-
import { ItemMeta } from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
export var AdditionalSuffix = styled.div.withConfig({
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
import { Tag } from "@synerise/ds-tag/dist/Tag.styles";
|
|
4
|
+
import { ItemLabel } from "../Item.styles.js";
|
|
5
|
+
import { ItemActionsWrapper } from "../ItemActions/ItemActions.styles.js";
|
|
6
|
+
import { ItemMeta } from "../ItemMeta/ItemMeta.styles.js";
|
|
7
|
+
const dashedStyle = (props) => css(["&&{box-shadow:0 0 0 0 transparent;border:1px dashed ", ";}&&:hover{border:1px dashed ", ";}"], props.theme.palette["grey-300"], props.theme.palette["grey-400"]);
|
|
8
|
+
const AdditionalSuffix = /* @__PURE__ */ styled.div.withConfig({
|
|
11
9
|
displayName: "ContentItemstyles__AdditionalSuffix",
|
|
12
10
|
componentId: "sc-13pyu4r-0"
|
|
13
11
|
})(["margin-left:8px;"]);
|
|
14
|
-
|
|
12
|
+
const DraggerWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
15
13
|
displayName: "ContentItemstyles__DraggerWrapper",
|
|
16
14
|
componentId: "sc-13pyu4r-1"
|
|
17
|
-
})(["cursor:pointer;display:flex;opacity:", ";"],
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export var IconWrapper = styled.div.withConfig({
|
|
15
|
+
})(["cursor:pointer;display:flex;opacity:", ";"], ({
|
|
16
|
+
disabled
|
|
17
|
+
}) => disabled ? "0.4" : "1");
|
|
18
|
+
const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
22
19
|
displayName: "ContentItemstyles__IconWrapper",
|
|
23
20
|
componentId: "sc-13pyu4r-2"
|
|
24
21
|
})(["display:flex;"]);
|
|
25
|
-
|
|
22
|
+
const MoveItemButtons = /* @__PURE__ */ styled.div.withConfig({
|
|
26
23
|
displayName: "ContentItemstyles__MoveItemButtons",
|
|
27
24
|
componentId: "sc-13pyu4r-3"
|
|
28
25
|
})(["display:none;flex-direction:row;align-items:flex-start;justify-content:center;margin-right:8px;.ds-button{margin-left:8px;&:first-child{margin-left:0;}}"]);
|
|
29
|
-
|
|
26
|
+
const ItemHeaderPrefix = /* @__PURE__ */ styled.div.withConfig({
|
|
30
27
|
displayName: "ContentItemstyles__ItemHeaderPrefix",
|
|
31
28
|
componentId: "sc-13pyu4r-4"
|
|
32
|
-
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;", "{margin:0;}", "{svg{color:", ";fill:", ";}}"], Tag, DraggerWrapper,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
export var ItemHeaderSuffix = styled.div.withConfig({
|
|
29
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;", "{margin:0;}", "{svg{color:", ";fill:", ";}}"], Tag, DraggerWrapper, ({
|
|
30
|
+
theme
|
|
31
|
+
}) => theme.palette["grey-400"], ({
|
|
32
|
+
theme
|
|
33
|
+
}) => theme.palette["grey-400"]);
|
|
34
|
+
const ItemHeaderSuffix = /* @__PURE__ */ styled.div.withConfig({
|
|
40
35
|
displayName: "ContentItemstyles__ItemHeaderSuffix",
|
|
41
36
|
componentId: "sc-13pyu4r-5"
|
|
42
|
-
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;.ds-dropdown-trigger{cursor:pointer;svg{transition:all 0.3s ease;}&.ant-dropdown-open,&:hover{svg{color:", ";fill:", ";}}}"],
|
|
43
|
-
|
|
44
|
-
}, function (props) {
|
|
45
|
-
return props.theme.palette['blue-600'];
|
|
46
|
-
});
|
|
47
|
-
export var ItemHeader = styled.div.withConfig({
|
|
37
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;.ds-dropdown-trigger{cursor:pointer;svg{transition:all 0.3s ease;}&.ant-dropdown-open,&:hover{svg{color:", ";fill:", ";}}}"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"]);
|
|
38
|
+
const ItemHeader = /* @__PURE__ */ styled.div.withConfig({
|
|
48
39
|
displayName: "ContentItemstyles__ItemHeader",
|
|
49
40
|
componentId: "sc-13pyu4r-6"
|
|
50
|
-
})(["display:flex;flex-direction:row;align-items:center;justify-content:stretch;width:100%;padding:12px;cursor:pointer;max-height:48px;position:relative;", " ", "{gap:", "px;}gap:", "px;", " ", "{padding:0;}&:hover{.suffix--hide-on-hover{display:none;}", "{color:", ";}", "{display:flex;}", "{svg{color:", ";fill:", ";}}", "{display:flex;}}"],
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
}, ItemMeta, ItemLabel, function (_ref4) {
|
|
59
|
-
var theme = _ref4.theme;
|
|
60
|
-
return theme.palette['grey-800'];
|
|
61
|
-
}, ItemActionsWrapper, DraggerWrapper, function (_ref5) {
|
|
62
|
-
var theme = _ref5.theme;
|
|
63
|
-
return theme.palette['grey-600'];
|
|
64
|
-
}, function (_ref6) {
|
|
65
|
-
var theme = _ref6.theme;
|
|
66
|
-
return theme.palette['grey-600'];
|
|
67
|
-
}, MoveItemButtons);
|
|
68
|
-
export var ContentWrapper = styled.div.withConfig({
|
|
41
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:stretch;width:100%;padding:12px;cursor:pointer;max-height:48px;position:relative;", " ", "{gap:", "px;}gap:", "px;", " ", "{padding:0;}&:hover{.suffix--hide-on-hover{display:none;}", "{color:", ";}", "{display:flex;}", "{svg{color:", ";fill:", ";}}", "{display:flex;}}"], (props) => props.size === "large" && css(["", " ", "{position:absolute;left:0;}"], props.hasDescription && "align-items: flex-start;", DraggerWrapper), ItemHeaderPrefix, (props) => props.size === "large" ? 16 : 12, (props) => props.size === "large" ? 16 : 12, (props) => !props.hasPrefix && `padding-left:16px;`, ItemMeta, ItemLabel, ({
|
|
42
|
+
theme
|
|
43
|
+
}) => theme.palette["grey-800"], ItemActionsWrapper, DraggerWrapper, ({
|
|
44
|
+
theme
|
|
45
|
+
}) => theme.palette["grey-600"], ({
|
|
46
|
+
theme
|
|
47
|
+
}) => theme.palette["grey-600"], MoveItemButtons);
|
|
48
|
+
const ContentWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
69
49
|
displayName: "ContentItemstyles__ContentWrapper",
|
|
70
50
|
componentId: "sc-13pyu4r-7"
|
|
71
|
-
})(["padding:", ";width:100%;border-top:1px solid ", ";opacity:1;"],
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
theme = _ref8.theme;
|
|
80
|
-
return greyBackground ? '0 4px 12px 0 rgba(35, 41, 54, 0.04)' : "0 0 0 1px " + theme.palette['grey-200'];
|
|
51
|
+
})(["padding:", ";width:100%;border-top:1px solid ", ";opacity:1;"], (props) => props.withoutPadding ? "0px" : "16px 24px 24px", ({
|
|
52
|
+
theme
|
|
53
|
+
}) => theme.palette["grey-200"]);
|
|
54
|
+
const standardShadow = ({
|
|
55
|
+
greyBackground,
|
|
56
|
+
theme
|
|
57
|
+
}) => {
|
|
58
|
+
return greyBackground ? "0 4px 12px 0 rgba(35, 41, 54, 0.04)" : `0 0 0 1px ${theme.palette["grey-200"]}`;
|
|
81
59
|
};
|
|
82
|
-
|
|
60
|
+
const ItemContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
83
61
|
displayName: "ContentItemstyles__ItemContainer",
|
|
84
62
|
componentId: "sc-13pyu4r-8"
|
|
85
|
-
})(["width:100%;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;margin-bottom:16px;border-radius:3px;position:relative;", " ", " ", " ", " ", " && .item-content-animation{width:100%;}", " ", ""],
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
export var ToggleContentWrapper = styled.div.withConfig({
|
|
63
|
+
})(["width:100%;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;margin-bottom:16px;border-radius:3px;position:relative;", " ", " ", " ", " ", " && .item-content-animation{width:100%;}", " ", ""], (props) => props.selected && `
|
|
64
|
+
outline: 2px solid ${props.theme.palette["blue-600"]} !important;
|
|
65
|
+
`, (props) => props.isDragOverlay ? `box-shadow: ${standardShadow(props)}, 0px 16px 32px 0px ${props.theme.palette["grey-200"]};
|
|
66
|
+
` : css(["box-shadow:", ";"], standardShadow(props)), (props) => props.isDragPlaceholder ? css(["background-color:", ";outline:1px dashed ", " !important;box-shadow:0;box-sizing:border-box;border-radius:3px;", "{visibility:hidden;opacity:0;}", "{display:none;}"], props.theme.palette["blue-050"], props.theme.palette["blue-300"], ItemHeader, ContentWrapper) : css(["background-color:", ";"], props.theme.palette.white), (props) => props.isDisabled && `
|
|
67
|
+
opacity: 0.4;
|
|
68
|
+
cursor: default;
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
`, ({
|
|
71
|
+
greyBackground,
|
|
72
|
+
isDragOverlay,
|
|
73
|
+
theme
|
|
74
|
+
}) => !greyBackground && !isDragOverlay && `
|
|
75
|
+
&:hover {
|
|
76
|
+
box-shadow: 0 0 0 1px ${theme.palette["grey-300"]};
|
|
77
|
+
}
|
|
78
|
+
`, (props) => !!props.dashed && dashedStyle(props), (props) => props.size === "large" && css(["", "{max-height:none;padding:24px;}"], ItemHeader));
|
|
79
|
+
const ToggleContentWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
104
80
|
displayName: "ContentItemstyles__ToggleContentWrapper",
|
|
105
81
|
componentId: "sc-13pyu4r-9"
|
|
106
82
|
})(["margin-left:12px;line-height:0;"]);
|
|
107
|
-
|
|
83
|
+
const DropdownTrigger = /* @__PURE__ */ styled(Button).withConfig({
|
|
108
84
|
displayName: "ContentItemstyles__DropdownTrigger",
|
|
109
85
|
componentId: "sc-13pyu4r-10"
|
|
110
86
|
})(["margin-left:12px;"]);
|
|
111
|
-
|
|
87
|
+
const FilterDropdownTrigger = /* @__PURE__ */ styled(Button).withConfig({
|
|
112
88
|
displayName: "ContentItemstyles__FilterDropdownTrigger",
|
|
113
89
|
componentId: "sc-13pyu4r-11"
|
|
114
90
|
})(["margin-left:0px;"]);
|
|
115
|
-
|
|
91
|
+
const DropdownWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
116
92
|
displayName: "ContentItemstyles__DropdownWrapper",
|
|
117
93
|
componentId: "sc-13pyu4r-12"
|
|
118
|
-
})([""]);
|
|
94
|
+
})([""]);
|
|
95
|
+
export {
|
|
96
|
+
AdditionalSuffix,
|
|
97
|
+
ContentWrapper,
|
|
98
|
+
DraggerWrapper,
|
|
99
|
+
DropdownTrigger,
|
|
100
|
+
DropdownWrapper,
|
|
101
|
+
FilterDropdownTrigger,
|
|
102
|
+
IconWrapper,
|
|
103
|
+
ItemContainer,
|
|
104
|
+
ItemHeader,
|
|
105
|
+
ItemHeaderPrefix,
|
|
106
|
+
ItemHeaderSuffix,
|
|
107
|
+
MoveItemButtons,
|
|
108
|
+
ToggleContentWrapper
|
|
109
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { ComponentType, HTMLAttributes, ReactNode, ReactText } from 'react';
|
|
2
|
+
import { StyledComponent } from 'styled-components';
|
|
3
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
4
|
+
import { ItemProps, Texts } from '../../ManageableList.types';
|
|
5
5
|
type BaseContentItemProps = Omit<ContentItemHeaderProps, 'texts' | 'isExpanded' | 'setIsExpanded'> & {
|
|
6
6
|
dashed?: boolean;
|
|
7
7
|
expanded?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ContentItemHeaderProps } from './ContentItem.types';
|
|
3
3
|
export declare const ContentItemHeader: ({ onRemove, onUpdate, onDuplicate, draggable, item, changeOrderDisabled, texts, hideExpander, onExpand, onSelect, headerSuffix, headerPrefix, onMoveTop, onMoveBottom, isFirst, isLast, isExpanded, dragHandleProps, isDragOverlay, setIsExpanded, size, }: ContentItemHeaderProps) => React.JSX.Element;
|
|
@@ -1,151 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import Button from
|
|
4
|
-
import { useTheme } from
|
|
5
|
-
import Dropdown from
|
|
6
|
-
import Icon, {
|
|
7
|
-
import Tooltip from
|
|
8
|
-
import ItemActions from
|
|
9
|
-
import ItemMeta from
|
|
10
|
-
import ItemName from
|
|
11
|
-
import ItemNameLarge from
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
setEditMode = _useState[1];
|
|
40
|
-
var updateName = useCallback(function (updateParams) {
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useMemo } from "react";
|
|
3
|
+
import Button from "@synerise/ds-button";
|
|
4
|
+
import { useTheme } from "@synerise/ds-core";
|
|
5
|
+
import Dropdown from "@synerise/ds-dropdown";
|
|
6
|
+
import Icon, { AngleTopS, AngleBottomS, DragHandleM, OptionHorizontalM } from "@synerise/ds-icon";
|
|
7
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
8
|
+
import ItemActions from "../ItemActions/ItemActions.js";
|
|
9
|
+
import { ItemMeta } from "../ItemMeta/ItemMeta.js";
|
|
10
|
+
import ItemName from "../ItemName/ItemName.js";
|
|
11
|
+
import ItemNameLarge from "../ItemNameLarge/ItemNameLarge.js";
|
|
12
|
+
import { MoveItemButtons, ItemHeader, ItemHeaderPrefix, DraggerWrapper, IconWrapper, ItemHeaderSuffix, ToggleContentWrapper, DropdownWrapper, DropdownTrigger, AdditionalSuffix } from "./ContentItem.styles.js";
|
|
13
|
+
const ContentItemHeader = ({
|
|
14
|
+
onRemove,
|
|
15
|
+
onUpdate,
|
|
16
|
+
onDuplicate,
|
|
17
|
+
draggable,
|
|
18
|
+
item,
|
|
19
|
+
changeOrderDisabled,
|
|
20
|
+
texts,
|
|
21
|
+
hideExpander,
|
|
22
|
+
onExpand,
|
|
23
|
+
onSelect,
|
|
24
|
+
headerSuffix,
|
|
25
|
+
headerPrefix,
|
|
26
|
+
onMoveTop,
|
|
27
|
+
onMoveBottom,
|
|
28
|
+
isFirst,
|
|
29
|
+
isLast,
|
|
30
|
+
isExpanded,
|
|
31
|
+
dragHandleProps,
|
|
32
|
+
isDragOverlay,
|
|
33
|
+
setIsExpanded,
|
|
34
|
+
size = "default"
|
|
35
|
+
}) => {
|
|
36
|
+
const theme = useTheme();
|
|
37
|
+
const [editMode, setEditMode] = useState(false);
|
|
38
|
+
const updateName = useCallback((updateParams) => {
|
|
41
39
|
setEditMode(false);
|
|
42
40
|
onUpdate && onUpdate(updateParams);
|
|
43
41
|
}, [onUpdate]);
|
|
44
|
-
|
|
42
|
+
const enterEditMode = () => {
|
|
45
43
|
setEditMode(true);
|
|
46
44
|
};
|
|
47
|
-
|
|
45
|
+
const stopPropagationHandler = (event) => {
|
|
48
46
|
event.stopPropagation();
|
|
49
47
|
};
|
|
50
|
-
|
|
51
|
-
if (size ===
|
|
48
|
+
const hasPrefix = useMemo(() => {
|
|
49
|
+
if (size === "large") {
|
|
52
50
|
return Boolean(headerPrefix || item.headerPrefix || item.tag || item.icon);
|
|
53
51
|
}
|
|
54
52
|
return Boolean(headerPrefix || draggable || item.tag || item.icon);
|
|
55
53
|
}, [draggable, item, size, headerPrefix]);
|
|
56
|
-
|
|
57
|
-
return (onMoveTop || onMoveBottom) &&
|
|
58
|
-
title: texts
|
|
59
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
60
|
-
type: "ghost",
|
|
61
|
-
mode: "single-icon",
|
|
62
|
-
onClick: function onClick(event) {
|
|
54
|
+
const renderMoveButtons = useMemo(() => {
|
|
55
|
+
return (onMoveTop || onMoveBottom) && /* @__PURE__ */ jsxs(MoveItemButtons, { children: [
|
|
56
|
+
onMoveTop && !isFirst && /* @__PURE__ */ jsx(Tooltip, { title: texts?.moveToTopTooltip, children: /* @__PURE__ */ jsx(Button, { type: "ghost", mode: "single-icon", onClick: (event) => {
|
|
63
57
|
event.stopPropagation();
|
|
64
58
|
onMoveTop(item);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
component: /*#__PURE__*/React.createElement(AngleTopS, null)
|
|
68
|
-
}))), onMoveBottom && !isLast && /*#__PURE__*/React.createElement(Tooltip, {
|
|
69
|
-
title: texts == null ? void 0 : texts.moveToBottomTooltip
|
|
70
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
71
|
-
type: "ghost",
|
|
72
|
-
mode: "single-icon",
|
|
73
|
-
onClick: function onClick(event) {
|
|
59
|
+
}, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AngleTopS, {}) }) }) }),
|
|
60
|
+
onMoveBottom && !isLast && /* @__PURE__ */ jsx(Tooltip, { title: texts?.moveToBottomTooltip, children: /* @__PURE__ */ jsx(Button, { type: "ghost", mode: "single-icon", onClick: (event) => {
|
|
74
61
|
event.stopPropagation();
|
|
75
62
|
onMoveBottom(item);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
component: /*#__PURE__*/React.createElement(AngleBottomS, null)
|
|
79
|
-
}))));
|
|
63
|
+
}, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AngleBottomS, {}) }) }) })
|
|
64
|
+
] });
|
|
80
65
|
}, [isFirst, isLast, item, onMoveBottom, onMoveTop, texts]);
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
} else if (!item.disableExpanding && !editMode && !item.disableHeaderClick) {
|
|
91
|
-
setIsExpanded(!isExpanded);
|
|
92
|
-
onExpand && onExpand(item.id, !isExpanded);
|
|
93
|
-
}
|
|
66
|
+
return /* @__PURE__ */ jsxs(ItemHeader, { size, hasPrefix, hasDescription: !!item.description, onClick: () => {
|
|
67
|
+
if (onSelect && !editMode) {
|
|
68
|
+
onSelect({
|
|
69
|
+
id: item.id
|
|
70
|
+
});
|
|
71
|
+
} else if (!item.disableExpanding && !editMode && !item.disableHeaderClick) {
|
|
72
|
+
setIsExpanded(!isExpanded);
|
|
73
|
+
onExpand && onExpand(item.id, !isExpanded);
|
|
94
74
|
}
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
!item.disableExpanding && setIsExpanded(!isExpanded);
|
|
127
|
-
!item.disableExpanding && onExpand && onExpand(item.id, !isExpanded);
|
|
128
|
-
},
|
|
129
|
-
expanded: isExpanded
|
|
130
|
-
})), item.dropdown && /*#__PURE__*/React.createElement(S.DropdownWrapper, {
|
|
131
|
-
onClick: stopPropagationHandler
|
|
132
|
-
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
133
|
-
trigger: ['click'],
|
|
134
|
-
overlay: item.dropdown,
|
|
135
|
-
placement: "bottomRight",
|
|
136
|
-
hideOnItemClick: true,
|
|
137
|
-
popoverProps: {
|
|
138
|
-
testId: 'manageable-list-content-item'
|
|
139
|
-
}
|
|
140
|
-
}, /*#__PURE__*/React.createElement(S.DropdownTrigger, {
|
|
141
|
-
className: "ds-dropdown-trigger",
|
|
142
|
-
mode: "single-icon",
|
|
143
|
-
type: "ghost"
|
|
144
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
145
|
-
component: /*#__PURE__*/React.createElement(OptionHorizontalM, null),
|
|
146
|
-
color: theme.palette['grey-600']
|
|
147
|
-
})))), item.additionalSuffix && /*#__PURE__*/React.createElement(S.AdditionalSuffix, null, item.additionalSuffix), (item.user || item.created) && /*#__PURE__*/React.createElement(ItemMeta, {
|
|
148
|
-
user: item.user,
|
|
149
|
-
created: item.created
|
|
150
|
-
})));
|
|
151
|
-
};
|
|
75
|
+
}, children: [
|
|
76
|
+
hasPrefix && /* @__PURE__ */ jsxs(ItemHeaderPrefix, { children: [
|
|
77
|
+
(draggable || isDragOverlay) && /* @__PURE__ */ jsx(DraggerWrapper, { ...dragHandleProps, disabled: Boolean(changeOrderDisabled), children: /* @__PURE__ */ jsx(Icon, { size: 24, component: /* @__PURE__ */ jsx(DragHandleM, {}) }) }),
|
|
78
|
+
item.headerPrefix ? item.headerPrefix : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79
|
+
item.tag && item.tag,
|
|
80
|
+
item.icon && /* @__PURE__ */ jsx(IconWrapper, { children: /* @__PURE__ */ jsx(Icon, { size: 24, component: item.icon, color: theme.palette["grey-600"] }) })
|
|
81
|
+
] }),
|
|
82
|
+
!!headerPrefix && headerPrefix
|
|
83
|
+
] }),
|
|
84
|
+
size === "default" ? /* @__PURE__ */ jsx(ItemName, { item, editMode, onUpdate: updateName }) : /* @__PURE__ */ jsx(ItemNameLarge, { item }),
|
|
85
|
+
/* @__PURE__ */ jsxs(ItemHeaderSuffix, { children: [
|
|
86
|
+
/* @__PURE__ */ jsx("div", { className: item.hideHeaderSuffixOnHover ? "suffix--hide-on-hover" : "", children: (!!headerSuffix || item?.headerSuffix) && headerSuffix || item.headerSuffix }),
|
|
87
|
+
renderMoveButtons,
|
|
88
|
+
/* @__PURE__ */ jsx(ItemActions, { item, duplicateAction: onDuplicate, duplicateActionTooltip: texts?.itemActionDuplicateTooltip, removeAction: onRemove, removeActionTooltip: texts?.itemActionDeleteTooltip, editAction: enterEditMode, editActionTooltip: texts?.itemActionRenameTooltip }),
|
|
89
|
+
" ",
|
|
90
|
+
item.content && !hideExpander && /* @__PURE__ */ jsx(ToggleContentWrapper, { "data-testid": "item-toggle-content-wrapper", children: /* @__PURE__ */ jsx(Button.Expander, { disabled: item.disableExpanding, onClick: (event) => {
|
|
91
|
+
!!event && event.stopPropagation();
|
|
92
|
+
!item.disableExpanding && setIsExpanded(!isExpanded);
|
|
93
|
+
!item.disableExpanding && onExpand && onExpand(item.id, !isExpanded);
|
|
94
|
+
}, expanded: isExpanded }) }),
|
|
95
|
+
item.dropdown && /* @__PURE__ */ jsx(DropdownWrapper, { onClick: stopPropagationHandler, children: /* @__PURE__ */ jsx(Dropdown, { trigger: ["click"], overlay: item.dropdown, placement: "bottomRight", hideOnItemClick: true, popoverProps: {
|
|
96
|
+
testId: "manageable-list-content-item"
|
|
97
|
+
}, children: /* @__PURE__ */ jsx(DropdownTrigger, { className: "ds-dropdown-trigger", mode: "single-icon", type: "ghost", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(OptionHorizontalM, {}), color: theme.palette["grey-600"] }) }) }) }),
|
|
98
|
+
item.additionalSuffix && /* @__PURE__ */ jsx(AdditionalSuffix, { children: item.additionalSuffix }),
|
|
99
|
+
(item.user || item.created) && /* @__PURE__ */ jsx(ItemMeta, { user: item.user, created: item.created })
|
|
100
|
+
] })
|
|
101
|
+
] });
|
|
102
|
+
};
|
|
103
|
+
export {
|
|
104
|
+
ContentItemHeader
|
|
105
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Props } from './Item.types';
|
|
3
3
|
export declare const DraggableItem: ({ item, ...rest }: Omit<Props, "dragHandleProps">) => React.JSX.Element;
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var dragStyle = {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSortable, CSS } from "@synerise/ds-sortable";
|
|
3
|
+
import Item from "./Item.js";
|
|
4
|
+
const DraggableItem = ({
|
|
5
|
+
item,
|
|
6
|
+
...rest
|
|
7
|
+
}) => {
|
|
8
|
+
const {
|
|
9
|
+
attributes,
|
|
10
|
+
listeners,
|
|
11
|
+
setNodeRef,
|
|
12
|
+
transform,
|
|
13
|
+
transition
|
|
14
|
+
} = useSortable({
|
|
15
|
+
id: item.id
|
|
16
|
+
});
|
|
17
|
+
const dragStyle = {
|
|
19
18
|
transform: CSS.Transform.toString(transform),
|
|
20
|
-
transition
|
|
19
|
+
transition
|
|
21
20
|
};
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
21
|
+
return /* @__PURE__ */ jsx("div", { style: dragStyle, ref: setNodeRef, children: /* @__PURE__ */ jsx(Item, { dragHandleProps: {
|
|
22
|
+
...attributes,
|
|
23
|
+
...listeners
|
|
24
|
+
}, item, ...rest }) });
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
DraggableItem
|
|
28
|
+
};
|