sag_components 1.0.11 → 1.0.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.
@@ -11,14 +11,17 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _OneColumnContainer = require("../OneColumnContainer.style");
13
13
  var _InfoIcon = require("./InfoIcon");
14
- var _excluded = ["children", "className", "ref", "width", "height", "infoText"];
14
+ var _core = require("@dnd-kit/core");
15
+ var _classnames = _interopRequireDefault(require("classnames"));
16
+ var _DroppableModule = _interopRequireDefault(require("./Droppable.module.css"));
17
+ var _excluded = ["children", "itemClass", "refId", "width", "height", "infoText"];
15
18
  /**
16
19
  * Primary UI component for user interaction
17
20
  */
18
21
  var OneColumnContainer = function OneColumnContainer(_ref) {
19
22
  var children = _ref.children,
20
- className = _ref.className,
21
- ref = _ref.ref,
23
+ itemClass = _ref.itemClass,
24
+ refId = _ref.refId,
22
25
  width = _ref.width,
23
26
  height = _ref.height,
24
27
  infoText = _ref.infoText,
@@ -27,15 +30,28 @@ var OneColumnContainer = function OneColumnContainer(_ref) {
27
30
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
28
31
  clicked = _useState2[0],
29
32
  setClicked = _useState2[1];
33
+ var _useDroppable = (0, _core.useDroppable)({
34
+ refId: refId
35
+ }),
36
+ isOver = _useDroppable.isOver,
37
+ setNodeRef = _useDroppable.setNodeRef;
30
38
  var onInfoClick = function onInfoClick() {
31
39
  setClicked(!clicked);
32
40
  };
33
41
  return /*#__PURE__*/_react.default.createElement(_OneColumnContainer.StyledContainer, {
34
- className: className,
35
- ref: ref,
42
+ className: (0, _classnames.default)(itemClass, isOver && _DroppableModule.default.over, dragging && _DroppableModule.default.dragging, children && _DroppableModule.default.dropped),
43
+ ref: setNodeRef,
36
44
  width: width,
37
45
  height: height
38
- }, children);
46
+ }, children, /*#__PURE__*/_react.default.createElement(_OneColumnContainer.InfoTextContainer, {
47
+ clicked: clicked,
48
+ width: width,
49
+ height: height
50
+ }, /*#__PURE__*/_react.default.createElement(_OneColumnContainer.InfoTextLabel, null, infoText)), /*#__PURE__*/_react.default.createElement(_OneColumnContainer.IconContainer, {
51
+ onClick: onInfoClick
52
+ }, /*#__PURE__*/_react.default.createElement(_InfoIcon.InfoIcon, {
53
+ clicked: clicked
54
+ })));
39
55
  };
40
56
  exports.OneColumnContainer = OneColumnContainer;
41
57
  OneColumnContainer.defaultProps = {};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
- "main": "dist/index.js",
5
+ "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "start": "react-scripts start",
8
8
  "build": "cross-env BABEL_ENV=production babel src -d dist",
@@ -39,6 +39,7 @@
39
39
  "styled-components": "^5.3.10"
40
40
  },
41
41
  "dependencies": {
42
+ "@dnd-kit/core": "^6.0.8",
42
43
  "@emotion/react": "^11.11.0",
43
44
  "@emotion/styled": "^11.11.0",
44
45
  "@fontsource/roboto": "^4.5.8",
@@ -47,7 +48,8 @@
47
48
  "@fortawesome/react-fontawesome": "^0.2.0",
48
49
  "@mui/icons-material": "^5.11.16",
49
50
  "@mui/material": "^5.13.0",
50
- "@mui/styled-engine-sc": "^5.12.0",
51
+ "@mui/styled-engine-sc": "^5.12.0",
52
+ "classnames": "^2.3.2",
51
53
  "hoopy": "^0.1.4",
52
54
  "react-scripts": "5.0.1"
53
55
  },
@@ -0,0 +1,106 @@
1
+ .Droppable {
2
+
3
+ position: relative;
4
+
5
+ padding-top: 80px;
6
+
7
+ text-align: center;
8
+
9
+ border-radius: 10px;
10
+
11
+ width: 340px;
12
+
13
+ height: 340px;
14
+
15
+ box-sizing: border-box;
16
+
17
+ background-color: #fff;
18
+
19
+ box-shadow: inset rgba(201, 211, 219, 0.5) 0 0 0 2px,
20
+
21
+ rgba(255, 255, 255, 0) 0 0 0 1px, rgba(201, 211, 219, 0.25) 20px 14px 24px;
22
+
23
+ transition: box-shadow 250ms ease;
24
+
25
+
26
+
27
+
28
+ > svg {
29
+
30
+ position: absolute;
31
+
32
+ left: 50%;
33
+
34
+ top: 50%;
35
+
36
+ width: 200px;
37
+
38
+ transform: translate3d(-50%, -50%, 0);
39
+
40
+ opacity: 0.8;
41
+
42
+ transition: opacity 300ms ease, transform 200ms ease;
43
+
44
+ user-select: none;
45
+
46
+ pointer-events: none;
47
+
48
+ }
49
+
50
+
51
+
52
+
53
+ &.dragging {
54
+
55
+ > svg {
56
+
57
+ opacity: 0.8;
58
+
59
+ }
60
+
61
+ }
62
+
63
+
64
+
65
+
66
+ &.over {
67
+
68
+ box-shadow: inset #ffffff 0 0 0 3px, rgba(201, 211, 219, 0.5) 20px 14px 24px;
69
+
70
+
71
+
72
+
73
+ > svg {
74
+
75
+ opacity: 1;
76
+
77
+ }
78
+
79
+
80
+
81
+
82
+ &.dropped {
83
+
84
+ box-shadow: inset rgba(4, 49, 85, 0.7) 0 0 0 3px,
85
+
86
+ rgba(201, 211, 219, 0.5) 20px 14px 24px;
87
+
88
+ }
89
+
90
+ }
91
+
92
+
93
+
94
+
95
+ &.dropped {
96
+
97
+ > svg {
98
+
99
+ opacity: 0.2;
100
+
101
+ transform: translate3d(-50%, 100%, 0) scale(0.8);
102
+
103
+ }
104
+
105
+ }
106
+ }
@@ -2,26 +2,35 @@ import React from 'react';
2
2
  import { useState } from "react";
3
3
  import { InfoTextLabel,InfoTextContainer,IconContainer, StyledContainer } from '../OneColumnContainer.style';
4
4
  import { InfoIcon } from "./InfoIcon";
5
-
5
+ import { useDroppable, UniqueIdentifier } from "@dnd-kit/core";
6
+ import classNames from "classnames";
7
+ import styles from "./Droppable.module.css"
6
8
  /**
7
9
  * Primary UI component for user interaction
8
10
  */
9
- export const OneColumnContainer = ({ children,className,ref,width,height,infoText,...props }) => {
11
+ export const OneColumnContainer = ({ children,itemClass,refId,width,height,infoText,...props }) => {
10
12
  const [clicked, setClicked] = useState(false);
11
-
13
+ const { isOver, setNodeRef } = useDroppable({
14
+ refId,
15
+ });
12
16
  const onInfoClick = ()=>{
13
17
  setClicked(!clicked)
14
18
  }
15
19
 
16
20
  return (
17
- <StyledContainer className={className} ref={ref} width={width} height={height}>
21
+ <StyledContainer className={classNames(
22
+ itemClass,
23
+ isOver && styles.over,
24
+ dragging && styles.dragging,
25
+ children && styles.dropped
26
+ )} ref={setNodeRef} width={width} height={height}>
18
27
  {children}
19
- {/* <InfoTextContainer clicked={clicked} width={width} height={height}>
28
+ <InfoTextContainer clicked={clicked} width={width} height={height}>
20
29
  <InfoTextLabel>{infoText}</InfoTextLabel>
21
30
  </InfoTextContainer>
22
31
  <IconContainer onClick={onInfoClick}>
23
32
  <InfoIcon clicked={clicked} />
24
- </IconContainer> */}
33
+ </IconContainer>
25
34
  </StyledContainer>
26
35
  );
27
36
  };