@visns-studio/visns-components 2.5.4 → 2.5.6

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.
@@ -1,12 +1,17 @@
1
1
  import React from 'react';
2
2
  import { SortableElement } from 'react-sortable-hoc';
3
- import { ChevronVertical } from 'akar-icons';
4
-
5
- const SortableItem = (props) => {
6
- const { value, index } = props;
3
+ import { ChevronVertical, TrashCan } from 'akar-icons';
7
4
 
5
+ const SortableItem = ({ handleClick, handleDelete, index, value }) => {
8
6
  return (
9
- <li>
7
+ <li
8
+ onClick={(e) => {
9
+ if (handleClick) {
10
+ handleClick(e);
11
+ }
12
+ }}
13
+ data-key={index}
14
+ >
10
15
  <ChevronVertical strokeWidth={1} size={26} />
11
16
  {value.label}
12
17
  {value.hasOwnProperty('image_url') && value.image_url !== '' ? (
@@ -14,6 +19,16 @@ const SortableItem = (props) => {
14
19
  <img src={value.image_url} />
15
20
  </div>
16
21
  ) : null}
22
+ {handleDelete && (
23
+ <TrashCan
24
+ className="delete"
25
+ strokeWidth={1}
26
+ size={26}
27
+ onClick={handleDelete}
28
+ data-key={index}
29
+ data-label={value.label}
30
+ />
31
+ )}
17
32
  </li>
18
33
  );
19
34
  };
@@ -1,10 +1,8 @@
1
- import React from "react";
2
- import VisnsSortableItem from "./Item";
3
- import { SortableContainer } from "react-sortable-hoc";
4
-
5
- const SortableList = (props) => {
6
- const { items } = props;
1
+ import React from 'react';
2
+ import VisnsSortableItem from './Item';
3
+ import { SortableContainer } from 'react-sortable-hoc';
7
4
 
5
+ const SortableList = ({ handleClick, handleDelete, items }) => {
8
6
  return (
9
7
  <ul className="sortlist">
10
8
  {items.map((value, index) => (
@@ -12,6 +10,8 @@ const SortableList = (props) => {
12
10
  key={`item-${index}`}
13
11
  index={index}
14
12
  value={value}
13
+ handleClick={handleClick}
14
+ handleDelete={handleDelete}
15
15
  />
16
16
  ))}
17
17
  </ul>
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "react-dom": "^17.0.1"
43
43
  },
44
44
  "name": "@visns-studio/visns-components",
45
- "version": "2.5.4",
45
+ "version": "2.5.6",
46
46
  "description": "Various packages to assist in the development of our Custom Applications.",
47
47
  "main": "index.js",
48
48
  "scripts": {