@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.
Files changed (83) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +7 -6
  3. package/dist/AddBlankItem/AddBlankItem.d.ts +2 -2
  4. package/dist/AddBlankItem/AddBlankItem.js +19 -22
  5. package/dist/AddBlankItem/AddBlankItem.styles.d.ts +2 -2
  6. package/dist/AddBlankItem/AddBlankItem.styles.js +9 -5
  7. package/dist/AddBlankItem/AddBlankItem.types.d.ts +1 -1
  8. package/dist/AddBlankItem/AddBlankItem.types.js +1 -1
  9. package/dist/AddItem/AddItem.d.ts +3 -3
  10. package/dist/AddItem/AddItem.js +14 -18
  11. package/dist/AddItem/AddItem.styles.d.ts +1 -1
  12. package/dist/AddItem/AddItem.styles.js +6 -3
  13. package/dist/AddItem/AddItem.types.d.ts +1 -1
  14. package/dist/AddItem/AddItem.types.js +1 -1
  15. package/dist/AddItemWithName/AddItemWithName.d.ts +2 -2
  16. package/dist/AddItemWithName/AddItemWithName.js +30 -43
  17. package/dist/AddItemWithName/AddItemWithName.styles.d.ts +2 -2
  18. package/dist/AddItemWithName/AddItemWithName.styles.js +9 -5
  19. package/dist/AddItemWithName/AddItemWithName.types.d.ts +1 -1
  20. package/dist/AddItemWithName/AddItemWithName.types.js +1 -1
  21. package/dist/Item/BlankItem/BlankItem.d.ts +2 -2
  22. package/dist/Item/BlankItem/BlankItem.js +43 -61
  23. package/dist/Item/BlankItem/BlankItem.styles.d.ts +4 -4
  24. package/dist/Item/BlankItem/BlankItem.styles.js +26 -21
  25. package/dist/Item/BlankItem/BlankItem.types.d.ts +3 -3
  26. package/dist/Item/BlankItem/BlankItem.types.js +1 -1
  27. package/dist/Item/ContentItem/ContentItem.d.ts +43 -43
  28. package/dist/Item/ContentItem/ContentItem.js +58 -99
  29. package/dist/Item/ContentItem/ContentItem.styles.d.ts +45 -45
  30. package/dist/Item/ContentItem/ContentItem.styles.js +76 -85
  31. package/dist/Item/ContentItem/ContentItem.types.d.ts +4 -4
  32. package/dist/Item/ContentItem/ContentItem.types.js +1 -1
  33. package/dist/Item/ContentItem/ContentItemHeader.d.ts +2 -2
  34. package/dist/Item/ContentItem/ContentItemHeader.js +88 -134
  35. package/dist/Item/DraggableItem.d.ts +2 -2
  36. package/dist/Item/DraggableItem.js +26 -27
  37. package/dist/Item/FilterItem/FilterItem.d.ts +43 -43
  38. package/dist/Item/FilterItem/FilterItem.js +74 -140
  39. package/dist/Item/FilterItem/FilterItem.styles.d.ts +3 -3
  40. package/dist/Item/FilterItem/FilterItem.styles.js +17 -27
  41. package/dist/Item/FilterItem/FilterItem.types.d.ts +2 -2
  42. package/dist/Item/FilterItem/FilterItem.types.js +1 -1
  43. package/dist/Item/Item.d.ts +2 -2
  44. package/dist/Item/Item.js +39 -90
  45. package/dist/Item/Item.styles.d.ts +9 -9
  46. package/dist/Item/Item.styles.js +50 -48
  47. package/dist/Item/Item.types.d.ts +1 -1
  48. package/dist/Item/Item.types.js +1 -1
  49. package/dist/Item/ItemActions/ItemActions.d.ts +2 -2
  50. package/dist/Item/ItemActions/ItemActions.js +41 -43
  51. package/dist/Item/ItemActions/ItemActions.styles.d.ts +1 -1
  52. package/dist/Item/ItemActions/ItemActions.styles.js +9 -7
  53. package/dist/Item/ItemActions/ItemActions.types.d.ts +2 -2
  54. package/dist/Item/ItemActions/ItemActions.types.js +1 -1
  55. package/dist/Item/ItemMeta/ItemMeta.d.ts +2 -2
  56. package/dist/Item/ItemMeta/ItemMeta.js +27 -22
  57. package/dist/Item/ItemMeta/ItemMeta.styles.d.ts +2 -2
  58. package/dist/Item/ItemMeta/ItemMeta.styles.js +9 -7
  59. package/dist/Item/ItemMeta/ItemMeta.types.js +1 -1
  60. package/dist/Item/ItemName/ItemName.d.ts +2 -2
  61. package/dist/Item/ItemName/ItemName.js +36 -55
  62. package/dist/Item/ItemName/ItemName.types.d.ts +2 -2
  63. package/dist/Item/ItemName/ItemName.types.js +1 -1
  64. package/dist/Item/ItemNameLarge/ItemNameLarge.d.ts +2 -2
  65. package/dist/Item/ItemNameLarge/ItemNameLarge.js +17 -13
  66. package/dist/Item/ItemNameLarge/ItemNameLarge.types.d.ts +1 -1
  67. package/dist/Item/ItemNameLarge/ItemNameLarge.types.js +1 -1
  68. package/dist/Item/SimpleItem/SimpleItem.d.ts +7 -7
  69. package/dist/Item/SimpleItem/SimpleItem.js +34 -56
  70. package/dist/Item/SimpleItem/SimpleItem.types.d.ts +2 -2
  71. package/dist/Item/SimpleItem/SimpleItem.types.js +1 -1
  72. package/dist/ManageableList.d.ts +4 -4
  73. package/dist/ManageableList.js +106 -164
  74. package/dist/ManageableList.styles.d.ts +2 -2
  75. package/dist/ManageableList.styles.js +12 -11
  76. package/dist/ManageableList.types.d.ts +2 -2
  77. package/dist/ManageableList.types.js +18 -14
  78. package/dist/hooks/useTexts.d.ts +1 -1
  79. package/dist/hooks/useTexts.js +31 -89
  80. package/dist/index.js +12 -5
  81. package/dist/modules.d.js +1 -1
  82. package/dist/modules.d.ts +0 -0
  83. package/package.json +21 -21
@@ -1,118 +1,109 @@
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';
5
- import { ItemActionsWrapper } from '../ItemActions/ItemActions.styles';
6
- import { ItemMeta } from '../ItemMeta/ItemMeta.styles';
7
- var dashedStyle = function dashedStyle(props) {
8
- return 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']);
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
- export var DraggerWrapper = styled.div.withConfig({
12
+ const DraggerWrapper = /* @__PURE__ */ styled.div.withConfig({
15
13
  displayName: "ContentItemstyles__DraggerWrapper",
16
14
  componentId: "sc-13pyu4r-1"
17
- })(["cursor:pointer;display:flex;opacity:", ";"], function (_ref) {
18
- var disabled = _ref.disabled;
19
- return disabled ? '0.4' : '1';
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
- export var MoveItemButtons = styled.div.withConfig({
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
- export var ItemHeaderPrefix = styled.div.withConfig({
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, function (_ref2) {
33
- var theme = _ref2.theme;
34
- return theme.palette['grey-400'];
35
- }, function (_ref3) {
36
- var theme = _ref3.theme;
37
- return theme.palette['grey-400'];
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:", ";}}}"], function (props) {
43
- return props.theme.palette['blue-600'];
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;}}"], function (props) {
51
- return props.size === 'large' && css(["", " ", "{position:absolute;left:0;}"], props.hasDescription && 'align-items: flex-start;', DraggerWrapper);
52
- }, ItemHeaderPrefix, function (props) {
53
- return props.size === 'large' ? 16 : 12;
54
- }, function (props) {
55
- return props.size === 'large' ? 16 : 12;
56
- }, function (props) {
57
- return !props.hasPrefix && "padding-left:16px;";
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;"], function (props) {
72
- return props.withoutPadding ? '0px' : '16px 24px 24px';
73
- }, function (_ref7) {
74
- var theme = _ref7.theme;
75
- return theme.palette['grey-200'];
76
- });
77
- var standardShadow = function standardShadow(_ref8) {
78
- var greyBackground = _ref8.greyBackground,
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
- export var ItemContainer = styled.div.withConfig({
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%;}", " ", ""], function (props) {
86
- return props.selected && "\n outline: 2px solid " + props.theme.palette['blue-600'] + " !important;\n ";
87
- }, function (props) {
88
- return props.isDragOverlay ? "box-shadow: " + standardShadow(props) + ", 0px 16px 32px 0px " + props.theme.palette['grey-200'] + ";\n" : css(["box-shadow:", ";"], standardShadow(props));
89
- }, function (props) {
90
- return 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);
91
- }, function (props) {
92
- return props.isDisabled && "\n opacity: 0.4;\n cursor: default;\n pointer-events: none;\n ";
93
- }, function (_ref9) {
94
- var greyBackground = _ref9.greyBackground,
95
- isDragOverlay = _ref9.isDragOverlay,
96
- theme = _ref9.theme;
97
- return !greyBackground && !isDragOverlay && "\n &:hover {\n box-shadow: 0 0 0 1px " + theme.palette['grey-300'] + ";\n }\n ";
98
- }, function (props) {
99
- return !!props.dashed && dashedStyle(props);
100
- }, function (props) {
101
- return props.size === 'large' && css(["", "{max-height:none;padding:24px;}"], ItemHeader);
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
- export var DropdownTrigger = styled(Button).withConfig({
83
+ const DropdownTrigger = /* @__PURE__ */ styled(Button).withConfig({
108
84
  displayName: "ContentItemstyles__DropdownTrigger",
109
85
  componentId: "sc-13pyu4r-10"
110
86
  })(["margin-left:12px;"]);
111
- export var FilterDropdownTrigger = styled(Button).withConfig({
87
+ const FilterDropdownTrigger = /* @__PURE__ */ styled(Button).withConfig({
112
88
  displayName: "ContentItemstyles__FilterDropdownTrigger",
113
89
  componentId: "sc-13pyu4r-11"
114
90
  })(["margin-left:0px;"]);
115
- export var DropdownWrapper = styled.div.withConfig({
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 { type ComponentType, type HTMLAttributes, type ReactNode, type ReactText } from 'react';
2
- import { type StyledComponent } from 'styled-components';
3
- import type { WithHTMLAttributes } from '@synerise/ds-utils';
4
- import { type ItemProps, type Texts } from '../../ManageableList.types';
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
- export {};
1
+
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- import type { ContentItemHeaderProps } from './ContentItem.types';
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
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useMemo, useState } 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, { AngleBottomS, AngleTopS, DragHandleM, OptionHorizontalM } from '@synerise/ds-icon';
7
- import Tooltip from '@synerise/ds-tooltip';
8
- import ItemActions from '../ItemActions/ItemActions';
9
- import ItemMeta from '../ItemMeta/ItemMeta';
10
- import ItemName from '../ItemName/ItemName';
11
- import ItemNameLarge from '../ItemNameLarge/ItemNameLarge';
12
- import * as S from './ContentItem.styles';
13
- export var ContentItemHeader = function ContentItemHeader(_ref) {
14
- var onRemove = _ref.onRemove,
15
- onUpdate = _ref.onUpdate,
16
- onDuplicate = _ref.onDuplicate,
17
- draggable = _ref.draggable,
18
- item = _ref.item,
19
- changeOrderDisabled = _ref.changeOrderDisabled,
20
- texts = _ref.texts,
21
- hideExpander = _ref.hideExpander,
22
- onExpand = _ref.onExpand,
23
- onSelect = _ref.onSelect,
24
- headerSuffix = _ref.headerSuffix,
25
- headerPrefix = _ref.headerPrefix,
26
- onMoveTop = _ref.onMoveTop,
27
- onMoveBottom = _ref.onMoveBottom,
28
- isFirst = _ref.isFirst,
29
- isLast = _ref.isLast,
30
- isExpanded = _ref.isExpanded,
31
- dragHandleProps = _ref.dragHandleProps,
32
- isDragOverlay = _ref.isDragOverlay,
33
- setIsExpanded = _ref.setIsExpanded,
34
- _ref$size = _ref.size,
35
- size = _ref$size === void 0 ? 'default' : _ref$size;
36
- var theme = useTheme();
37
- var _useState = useState(false),
38
- editMode = _useState[0],
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
- var enterEditMode = function enterEditMode() {
42
+ const enterEditMode = () => {
45
43
  setEditMode(true);
46
44
  };
47
- var stopPropagationHandler = function stopPropagationHandler(event) {
45
+ const stopPropagationHandler = (event) => {
48
46
  event.stopPropagation();
49
47
  };
50
- var hasPrefix = useMemo(function () {
51
- if (size === 'large') {
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
- var renderMoveButtons = useMemo(function () {
57
- return (onMoveTop || onMoveBottom) && /*#__PURE__*/React.createElement(S.MoveItemButtons, null, onMoveTop && !isFirst && /*#__PURE__*/React.createElement(Tooltip, {
58
- title: texts == null ? void 0 : texts.moveToTopTooltip
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
- }, /*#__PURE__*/React.createElement(Icon, {
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
- }, /*#__PURE__*/React.createElement(Icon, {
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 /*#__PURE__*/React.createElement(S.ItemHeader, {
82
- size: size,
83
- hasPrefix: hasPrefix,
84
- hasDescription: !!item.description,
85
- onClick: function onClick() {
86
- if (onSelect && !editMode) {
87
- onSelect({
88
- id: item.id
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
- }, hasPrefix && /*#__PURE__*/React.createElement(S.ItemHeaderPrefix, null, (draggable || isDragOverlay) && /*#__PURE__*/React.createElement(S.DraggerWrapper, _extends({}, dragHandleProps, {
96
- disabled: Boolean(changeOrderDisabled)
97
- }), /*#__PURE__*/React.createElement(Icon, {
98
- size: 24,
99
- component: /*#__PURE__*/React.createElement(DragHandleM, null)
100
- })), item.headerPrefix ? item.headerPrefix : /*#__PURE__*/React.createElement(React.Fragment, null, item.tag && item.tag, item.icon && /*#__PURE__*/React.createElement(S.IconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
101
- size: 24,
102
- component: item.icon,
103
- color: theme.palette['grey-600']
104
- }))), !!headerPrefix && headerPrefix), size === 'default' ? /*#__PURE__*/React.createElement(ItemName, {
105
- item: item,
106
- editMode: editMode,
107
- onUpdate: updateName
108
- }) : /*#__PURE__*/React.createElement(ItemNameLarge, {
109
- item: item
110
- }), /*#__PURE__*/React.createElement(S.ItemHeaderSuffix, null, /*#__PURE__*/React.createElement("div", {
111
- className: item.hideHeaderSuffixOnHover ? 'suffix--hide-on-hover' : ''
112
- }, (!!headerSuffix || (item == null ? void 0 : item.headerSuffix)) && headerSuffix || item.headerSuffix), renderMoveButtons, /*#__PURE__*/React.createElement(ItemActions, {
113
- item: item,
114
- duplicateAction: onDuplicate,
115
- duplicateActionTooltip: texts == null ? void 0 : texts.itemActionDuplicateTooltip,
116
- removeAction: onRemove,
117
- removeActionTooltip: texts == null ? void 0 : texts.itemActionDeleteTooltip,
118
- editAction: enterEditMode,
119
- editActionTooltip: texts == null ? void 0 : texts.itemActionRenameTooltip
120
- }), ' ', item.content && !hideExpander && /*#__PURE__*/React.createElement(S.ToggleContentWrapper, {
121
- "data-testid": "item-toggle-content-wrapper"
122
- }, /*#__PURE__*/React.createElement(Button.Expander, {
123
- disabled: item.disableExpanding,
124
- onClick: function onClick(event) {
125
- !!event && event.stopPropagation();
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 { type Props } from './Item.types';
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
- var _excluded = ["item"];
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React from 'react';
5
- import { CSS, useSortable } from '@synerise/ds-sortable';
6
- import Item from './Item';
7
- export var DraggableItem = function DraggableItem(_ref) {
8
- var item = _ref.item,
9
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
10
- var _useSortable = useSortable({
11
- id: item.id
12
- }),
13
- attributes = _useSortable.attributes,
14
- listeners = _useSortable.listeners,
15
- setNodeRef = _useSortable.setNodeRef,
16
- transform = _useSortable.transform,
17
- transition = _useSortable.transition;
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: transition
19
+ transition
21
20
  };
22
- return /*#__PURE__*/React.createElement("div", {
23
- style: dragStyle,
24
- ref: setNodeRef
25
- }, /*#__PURE__*/React.createElement(Item, _extends({
26
- dragHandleProps: _extends({}, attributes, listeners),
27
- item: item
28
- }, rest)));
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
+ };