@pie-lib/drag 2.1.0 → 2.1.5

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,35 @@
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
+ ## [2.1.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/drag@2.1.3...@pie-lib/drag@2.1.5) (2023-01-31)
7
+
8
+ **Note:** Version bump only for package @pie-lib/drag
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.1.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/drag@2.1.1...@pie-lib/drag@2.1.3) (2023-01-31)
15
+
16
+ **Note:** Version bump only for package @pie-lib/drag
17
+
18
+
19
+
20
+
21
+
22
+ ## [2.1.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/drag@2.1.0...@pie-lib/drag@2.1.1) (2023-01-31)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **drag:** add support for dragging events on touch devices ([b367c15](https://github.com/pie-framework/pie-lib/commit/b367c155df323a64da9f2b6633ec5eebda879e22))
28
+ * **drag:** downgrade react-dnd-touch-backend to a version that is compatible with react-dnd version 14.x. ([d8a3577](https://github.com/pie-framework/pie-lib/commit/d8a35779ac8c55573cf71b4dedfa3617780303e4))
29
+ * **drag:** prevent scroll for dragging placeholder board ([d37d211](https://github.com/pie-framework/pie-lib/commit/d37d2110af7a199e14d2c7f80720d65013f63602))
30
+
31
+
32
+
33
+
34
+
6
35
  # [2.1.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/drag@2.0.6...@pie-lib/drag@2.1.0) (2023-01-16)
7
36
 
8
37
 
@@ -90,7 +90,8 @@ var styles = function styles(theme) {
90
90
  flexWrap: 'wrap',
91
91
  alignItems: 'center',
92
92
  minHeight: '200px',
93
- justifyContent: 'center'
93
+ justifyContent: 'center',
94
+ overflow: 'hidden'
94
95
  }
95
96
  };
96
97
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/placeholder.jsx"],"names":["PlaceHolder","props","children","classes","className","isOver","type","grid","disabled","choiceBoard","names","placeholder","over","style","columns","gridTemplateColumns","rows","repeatValue","rowsRepeatValue","gridTemplateRows","board","propTypes","PropTypes","object","isRequired","shape","number","string","oneOfType","arrayOf","node","bool","index","styles","theme","width","height","background","palette","grey","border","transition","boxSizing","display","gridRowGap","spacing","unit","gridColumnGap","padding","boxShadow","paper","backgroundColor","flexWrap","alignItems","minHeight","justifyContent"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEO,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD,EAAW;AACpC,MAAQC,QAAR,GAAoFD,KAApF,CAAQC,QAAR;AAAA,MAAkBC,OAAlB,GAAoFF,KAApF,CAAkBE,OAAlB;AAAA,MAA2BC,SAA3B,GAAoFH,KAApF,CAA2BG,SAA3B;AAAA,MAAsCC,MAAtC,GAAoFJ,KAApF,CAAsCI,MAAtC;AAAA,MAA8CC,IAA9C,GAAoFL,KAApF,CAA8CK,IAA9C;AAAA,MAAoDC,IAApD,GAAoFN,KAApF,CAAoDM,IAApD;AAAA,MAA0DC,QAA1D,GAAoFP,KAApF,CAA0DO,QAA1D;AAAA,MAAoEC,WAApE,GAAoFR,KAApF,CAAoEQ,WAApE;AACA,MAAMC,KAAK,GAAG,4BACZP,OAAO,CAACQ,WADI,EAEZH,QAAQ,IAAIL,OAAO,CAACK,QAFR,EAGZH,MAAM,IAAIF,OAAO,CAACS,IAHN,EAIZT,OAAO,CAACG,IAAD,CAJK,EAKZF,SALY,CAAd;AAQA,MAAMS,KAAK,GAAG,EAAd;;AAEA,MAAIN,IAAI,IAAIA,IAAI,CAACO,OAAjB,EAA0B;AACxBD,IAAAA,KAAK,CAACE,mBAAN,oBAAsCR,IAAI,CAACO,OAA3C;AACD;;AACD,MAAIP,IAAI,IAAIA,IAAI,CA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MAAAA,MAAM,EAAE,mBAJG;AAKXC,MAAAA,UAAU,EAAE,0DALD;AAMXC,MAAAA,SAAS,EAAE,YANA;AAOXC,MAAAA,OAAO,EAAE,MAPE;AAQXC,MAAAA,UAAU,YAAKV,KAAK,CAACW,OAAN,CAAcC,IAAnB,OARC;AASXC,MAAAA,aAAa,YAAKb,KAAK,CAACW,OAAN,CAAcC,IAAnB,OATF;AAUXE,MAAAA,OAAO,EAAEd,KAAK,CAACW,OAAN,CAAcC,IAAd,GAAqB;AAVnB,KADY;AAazBtC,IAAAA,QAAQ,EAAE;AACRyC,MAAAA,SAAS,EAAE,MADH;AAERZ,MAAAA,UAAU,EAAEH,KAAK,CAACI,OAAN,CAAcD,UAAd,CAAyBa;AAF7B,KAbe;AAiBzBtC,IAAAA,IAAI,EAAE;AACJ4B,MAAAA,MAAM,sBAAeD,iBAAK,GAAL,CAAf,CADF;AAEJY,MAAAA,eAAe,YAAKZ,iBAAK,GAAL,CAAL;AAFX,KAjBmB;AAqBzBnB,IAAAA,KAAK,EAAE;AACLoB,MAAAA,MAAM,EAAE,mBADH;AAELQ,MAAAA,OAAO,EAAEd,KAAK,CAACW,OAAN,CAAcC,IAFlB;AAGLH,MAAAA,OAAO,EAAE,MAHJ;AAILS,MAAAA,QAAQ,EAAE,MAJL;AAKLC,MAAAA,UAAU,EAAE,QALP;AAMLC,MAAAA,SAAS,EAAE,OANN;AAOLC,MAAAA,cAAc,EAAE;AAPX;AArBkB,GAAZ;AAAA,CAAf;;eAgCe,wBAAWtB,MAAX,EAAmBjC,WAAnB,C","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport grey from '@material-ui/core/colors/grey';\n\nexport const PlaceHolder = (props) => {\n const { children, classes, className, isOver, type, grid, disabled, choiceBoard } = props;\n const names = classNames(\n classes.placeholder,\n disabled && classes.disabled,\n isOver && classes.over,\n classes[type],\n className,\n );\n\n const style = {};\n\n if (grid && grid.columns) {\n style.gridTemplateColumns = `repeat(${grid.columns}, 1fr)`;\n }\n if (grid && grid.rows) {\n const repeatValue = grid.rowsRepeatValue || '1fr';\n\n style.gridTemplateRows = `repeat(${grid.rows}, ${repeatValue})`;\n }\n\n return (\n <div style={style} className={choiceBoard ? classes.board : names}>\n {children}\n </div>\n );\n};\n\nPlaceHolder.propTypes = {\n classes: PropTypes.object.isRequired,\n grid: PropTypes.shape({\n columns: PropTypes.number,\n rows: PropTypes.number,\n // if a different value then 1fr is wanted\n rowsRepeatValue: PropTypes.string,\n }),\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n className: PropTypes.string,\n isOver: PropTypes.bool,\n index: PropTypes.number,\n type: PropTypes.string,\n disabled: PropTypes.bool,\n};\n\nconst styles = (theme) => ({\n placeholder: {\n width: '100%',\n height: '100%',\n background: theme.palette.grey[200],\n border: '1px solid #D1D1D1',\n transition: 'background-color 200ms linear, border-color 200ms linear',\n boxSizing: 'border-box',\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n padding: theme.spacing.unit * 1,\n },\n disabled: {\n boxShadow: 'none',\n background: theme.palette.background.paper,\n },\n over: {\n border: `1px solid ${grey[500]}`,\n backgroundColor: `${grey[300]}`,\n },\n board: {\n border: '1px solid #D1D1D1',\n padding: theme.spacing.unit,\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n minHeight: '200px',\n justifyContent: 'center',\n },\n});\n\nexport default withStyles(styles)(PlaceHolder);\n"],"file":"placeholder.js"}
1
+ {"version":3,"sources":["../src/placeholder.jsx"],"names":["PlaceHolder","props","children","classes","className","isOver","type","grid","disabled","choiceBoard","names","placeholder","over","style","columns","gridTemplateColumns","rows","repeatValue","rowsRepeatValue","gridTemplateRows","board","propTypes","PropTypes","object","isRequired","shape","number","string","oneOfType","arrayOf","node","bool","index","styles","theme","width","height","background","palette","grey","border","transition","boxSizing","display","gridRowGap","spacing","unit","gridColumnGap","padding","boxShadow","paper","backgroundColor","flexWrap","alignItems","minHeight","justifyContent","overflow"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEO,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD,EAAW;AACpC,MAAQC,QAAR,GAAoFD,KAApF,CAAQC,QAAR;AAAA,MAAkBC,OAAlB,GAAoFF,KAApF,CAAkBE,OAAlB;AAAA,MAA2BC,SAA3B,GAAoFH,KAApF,CAA2BG,SAA3B;AAAA,MAAsCC,MAAtC,GAAoFJ,KAApF,CAAsCI,MAAtC;AAAA,MAA8CC,IAA9C,GAAoFL,KAApF,CAA8CK,IAA9C;AAAA,MAAoDC,IAApD,GAAoFN,KAApF,CAAoDM,IAApD;AAAA,MAA0DC,QAA1D,GAAoFP,KAApF,CAA0DO,QAA1D;AAAA,MAAoEC,WAApE,GAAoFR,KAApF,CAAoEQ,WAApE;AACA,MAAMC,KAAK,GAAG,4BACZP,OAAO,CAACQ,WADI,EAEZH,QAAQ,IAAIL,OAAO,CAACK,QAFR,EAGZH,MAAM,IAAIF,OAAO,CAACS,IAHN,EAIZT,OAAO,CAACG,IAAD,CAJK,EAKZF,SALY,CAAd;AAQA,MAAMS,KAAK,GAAG,EAAd;;AAEA,MAAIN,IAAI,IAAIA,IAAI,CAACO,OAAjB,EAA0B;AACxBD,IAAAA,KAAK,CAACE,mBAAN,oBAAsCR,IAAI,CAACO,OAA3C;AACD;;AACD,MAAIP,IAAI,IAAIA,IAAI,CAACS,IAAjB,EAAuB;AACrB,QAAMC,WAAW,GAAGV,IAAI,CAACW,eAAL,IAAwB,KAA5C;AAEAL,IAAAA,KAAK,CAACM,gBAAN,oBAAmCZ,IAAI,CAACS,IAAxC,eAAiDC,WAAjD;AACD;;AAED,sBACE;AAAK,IAAA,KAAK,EAAEJ,KAAZ;AAAmB,IAAA,SAAS,EAAEJ,WAAW,GAAGN,OAAO,CAACiB,KAAX,GAAm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EAAEd,KAAK,CAACW,OAAN,CAAcC,IAAd,GAAqB;AAVnB,KADY;AAazBtC,IAAAA,QAAQ,EAAE;AACRyC,MAAAA,SAAS,EAAE,MADH;AAERZ,MAAAA,UAAU,EAAEH,KAAK,CAACI,OAAN,CAAcD,UAAd,CAAyBa;AAF7B,KAbe;AAiBzBtC,IAAAA,IAAI,EAAE;AACJ4B,MAAAA,MAAM,sBAAeD,iBAAK,GAAL,CAAf,CADF;AAEJY,MAAAA,eAAe,YAAKZ,iBAAK,GAAL,CAAL;AAFX,KAjBmB;AAqBzBnB,IAAAA,KAAK,EAAE;AACLoB,MAAAA,MAAM,EAAE,mBADH;AAELQ,MAAAA,OAAO,EAAEd,KAAK,CAACW,OAAN,CAAcC,IAFlB;AAGLH,MAAAA,OAAO,EAAE,MAHJ;AAILS,MAAAA,QAAQ,EAAE,MAJL;AAKLC,MAAAA,UAAU,EAAE,QALP;AAMLC,MAAAA,SAAS,EAAE,OANN;AAOLC,MAAAA,cAAc,EAAE,QAPX;AAQLC,MAAAA,QAAQ,EAAE;AARL;AArBkB,GAAZ;AAAA,CAAf;;eAiCe,wBAAWvB,MAAX,EAAmBjC,WAAnB,C","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport grey from '@material-ui/core/colors/grey';\n\nexport const PlaceHolder = (props) => {\n const { children, classes, className, isOver, type, grid, disabled, choiceBoard } = props;\n const names = classNames(\n classes.placeholder,\n disabled && classes.disabled,\n isOver && classes.over,\n classes[type],\n className,\n );\n\n const style = {};\n\n if (grid && grid.columns) {\n style.gridTemplateColumns = `repeat(${grid.columns}, 1fr)`;\n }\n if (grid && grid.rows) {\n const repeatValue = grid.rowsRepeatValue || '1fr';\n\n style.gridTemplateRows = `repeat(${grid.rows}, ${repeatValue})`;\n }\n\n return (\n <div style={style} className={choiceBoard ? classes.board : names}>\n {children}\n </div>\n );\n};\n\nPlaceHolder.propTypes = {\n classes: PropTypes.object.isRequired,\n grid: PropTypes.shape({\n columns: PropTypes.number,\n rows: PropTypes.number,\n // if a different value then 1fr is wanted\n rowsRepeatValue: PropTypes.string,\n }),\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n className: PropTypes.string,\n isOver: PropTypes.bool,\n index: PropTypes.number,\n type: PropTypes.string,\n disabled: PropTypes.bool,\n};\n\nconst styles = (theme) => ({\n placeholder: {\n width: '100%',\n height: '100%',\n background: theme.palette.grey[200],\n border: '1px solid #D1D1D1',\n transition: 'background-color 200ms linear, border-color 200ms linear',\n boxSizing: 'border-box',\n display: 'grid',\n gridRowGap: `${theme.spacing.unit}px`,\n gridColumnGap: `${theme.spacing.unit}px`,\n padding: theme.spacing.unit * 1,\n },\n disabled: {\n boxShadow: 'none',\n background: theme.palette.background.paper,\n },\n over: {\n border: `1px solid ${grey[500]}`,\n backgroundColor: `${grey[300]}`,\n },\n board: {\n border: '1px solid #D1D1D1',\n padding: theme.spacing.unit,\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n minHeight: '200px',\n justifyContent: 'center',\n overflow: 'hidden',\n },\n});\n\nexport default withStyles(styles)(PlaceHolder);\n"],"file":"placeholder.js"}
@@ -11,13 +11,16 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _reactDndHtml5Backend = require("react-dnd-html5-backend");
13
13
 
14
+ var _reactDndTouchBackend = require("react-dnd-touch-backend");
15
+
14
16
  var _reactDnd = require("react-dnd");
15
17
 
16
- // https://github.com/react-dnd/react-dnd/issues/3257
18
+ var isTouchEnabled = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; // https://github.com/react-dnd/react-dnd/issues/3257
19
+
17
20
  var _default = function _default(Component) {
18
21
  return function (props) {
19
22
  return /*#__PURE__*/_react["default"].createElement(_reactDnd.DndProvider, {
20
- backend: _reactDndHtml5Backend.HTML5Backend,
23
+ backend: isTouchEnabled ? _reactDndTouchBackend.TouchBackend : _reactDndHtml5Backend.HTML5Backend,
21
24
  context: window
22
25
  }, /*#__PURE__*/_react["default"].createElement(Component, props));
23
26
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/with-drag-context.js"],"names":["Component","props","HTML5Backend","window"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;eACe,kBAACA,SAAD;AAAA,SAAe,UAACC,KAAD;AAAA,wBAC5B,gCAAC,qBAAD;AAAa,MAAA,OAAO,EAAEC,kCAAtB;AAAoC,MAAA,OAAO,EAAEC;AAA7C,oBACE,gCAAC,SAAD,EAAeF,KAAf,CADF,CAD4B;AAAA,GAAf;AAAA,C","sourcesContent":["import React from 'react';\nimport { HTML5Backend } from 'react-dnd-html5-backend';\n\nimport { DndProvider } from 'react-dnd';\n\n// https://github.com/react-dnd/react-dnd/issues/3257\nexport default (Component) => (props) => (\n <DndProvider backend={HTML5Backend} context={window}>\n <Component {...props} />\n </DndProvider>\n);\n"],"file":"with-drag-context.js"}
1
+ {"version":3,"sources":["../src/with-drag-context.js"],"names":["isTouchEnabled","window","navigator","maxTouchPoints","msMaxTouchPoints","Component","props","TouchBackend","HTML5Backend"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAEA,IAAMA,cAAc,GAAG,kBAAkBC,MAAlB,IAA4BC,SAAS,CAACC,cAAV,GAA2B,CAAvD,IAA4DD,SAAS,CAACE,gBAAV,GAA6B,CAAhH,C,CAEA;;eACe,kBAACC,SAAD;AAAA,SAAe,UAACC,KAAD;AAAA,wBAC5B,gCAAC,qBAAD;AAAa,MAAA,OAAO,EAAEN,cAAc,GAAGO,kCAAH,GAAkBC,kCAAtD;AAAoE,MAAA,OAAO,EAAEP;AAA7E,oBACE,gCAAC,SAAD,EAAeK,KAAf,CADF,CAD4B;AAAA,GAAf;AAAA,C","sourcesContent":["import React from 'react';\nimport { HTML5Backend } from 'react-dnd-html5-backend';\nimport { TouchBackend } from 'react-dnd-touch-backend';\n\nimport { DndProvider } from 'react-dnd';\n\nconst isTouchEnabled = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;\n\n// https://github.com/react-dnd/react-dnd/issues/3257\nexport default (Component) => (props) => (\n <DndProvider backend={isTouchEnabled ? TouchBackend : HTML5Backend} context={window}>\n <Component {...props} />\n </DndProvider>\n);\n"],"file":"with-drag-context.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/drag",
3
- "version": "2.1.0",
3
+ "version": "2.1.5",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -9,7 +9,8 @@
9
9
  "classnames": "^2.2.6",
10
10
  "lodash": "^4.17.11",
11
11
  "react-dnd": "^14.0.5",
12
- "react-dnd-html5-backend": "^14.0.2"
12
+ "react-dnd-html5-backend": "^14.0.2",
13
+ "react-dnd-touch-backend": "^14.1.0"
13
14
  },
14
15
  "publishConfig": {
15
16
  "access": "public"
@@ -17,5 +18,5 @@
17
18
  "scripts": {},
18
19
  "author": "",
19
20
  "license": "ISC",
20
- "gitHead": "629368c10c78d61b6551df2b0f0a04ec56fdef99"
21
+ "gitHead": "20bdffee3f08bf1073c736e69fc873c9e434a743"
21
22
  }
@@ -77,6 +77,7 @@ const styles = (theme) => ({
77
77
  alignItems: 'center',
78
78
  minHeight: '200px',
79
79
  justifyContent: 'center',
80
+ overflow: 'hidden',
80
81
  },
81
82
  });
82
83
 
@@ -1,11 +1,14 @@
1
1
  import React from 'react';
2
2
  import { HTML5Backend } from 'react-dnd-html5-backend';
3
+ import { TouchBackend } from 'react-dnd-touch-backend';
3
4
 
4
5
  import { DndProvider } from 'react-dnd';
5
6
 
7
+ const isTouchEnabled = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
8
+
6
9
  // https://github.com/react-dnd/react-dnd/issues/3257
7
10
  export default (Component) => (props) => (
8
- <DndProvider backend={HTML5Backend} context={window}>
11
+ <DndProvider backend={isTouchEnabled ? TouchBackend : HTML5Backend} context={window}>
9
12
  <Component {...props} />
10
13
  </DndProvider>
11
14
  );