@equinor/echo-components 0.3.3 → 0.4.0

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.
@@ -5,6 +5,9 @@ export interface DialogGeneratorProps {
5
5
  children: React.ReactNode;
6
6
  title: string;
7
7
  actionButtons: ActionButton[];
8
+ open: boolean;
9
+ isDismissable?: boolean;
10
+ onClose?: () => void;
8
11
  }
9
12
  /**
10
13
  * Component that renders a dialog box based on input properties
@@ -14,6 +17,9 @@ export interface DialogGeneratorProps {
14
17
  * title: the title of the dialog
15
18
  * children: The main content of the dialog
16
19
  * actionButtons: the buttons to show in the dialog
20
+ * open: if the dialog should be open
21
+ * isDismissable: if the modal is closable by clicking aside or by hitting ESC key
22
+ * onClose: callback to be called when the dialog is closed
17
23
  * }
18
24
  * @return {*} {JSX.Element} Dialog component
19
25
  */
package/dist/index.js CHANGED
@@ -15423,6 +15423,9 @@ styleInject(css_248z$e);
15423
15423
  * title: the title of the dialog
15424
15424
  * children: The main content of the dialog
15425
15425
  * actionButtons: the buttons to show in the dialog
15426
+ * open: if the dialog should be open
15427
+ * isDismissable: if the modal is closable by clicking aside or by hitting ESC key
15428
+ * onClose: callback to be called when the dialog is closed
15426
15429
  * }
15427
15430
  * @return {*} {JSX.Element} Dialog component
15428
15431
  */
@@ -15431,10 +15434,18 @@ var DialogGenerator = function DialogGenerator(_ref) {
15431
15434
  var dialogStyle = _ref.dialogStyle,
15432
15435
  title = _ref.title,
15433
15436
  children = _ref.children,
15434
- actionButtons = _ref.actionButtons;
15437
+ actionButtons = _ref.actionButtons,
15438
+ open = _ref.open,
15439
+ isDismissable = _ref.isDismissable,
15440
+ _onClose = _ref.onClose;
15435
15441
  return /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Dialog, {
15436
- style: dialogStyle
15437
- }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Dialog.Title, null, title), /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Dialog.CustomContent, null, children), actionButtons.length > 0 && /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Dialog.Actions, {
15442
+ style: dialogStyle,
15443
+ open: open,
15444
+ isDismissable: isDismissable,
15445
+ onClose: function onClose() {
15446
+ return _onClose && _onClose();
15447
+ }
15448
+ }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Dialog.Header, null, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Dialog.Title, null, title)), /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Dialog.CustomContent, null, children), actionButtons.length > 0 && /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Dialog.Actions, {
15438
15449
  className: styles$a.footer
15439
15450
  }, actionButtons.map(function (actionButton, index) {
15440
15451
  return /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
@@ -17325,7 +17336,7 @@ function invariant(condition, message) {
17325
17336
  }
17326
17337
 
17327
17338
  /**!
17328
- * Sortable 1.14.0
17339
+ * Sortable 1.15.0
17329
17340
  * @author RubaXa <trash@rubaxa.org>
17330
17341
  * @author owenm <owen23355@gmail.com>
17331
17342
  * @license MIT
@@ -17453,7 +17464,7 @@ function _objectWithoutProperties(source, excluded) {
17453
17464
  return target;
17454
17465
  }
17455
17466
 
17456
- var version = "1.14.0";
17467
+ var version = "1.15.0";
17457
17468
 
17458
17469
  function userAgent(pattern) {
17459
17470
  if (typeof window !== 'undefined' && window.navigator) {
@@ -18374,11 +18385,11 @@ supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in
18374
18385
  return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
18375
18386
  },
18376
18387
 
18377
- /**
18378
- * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
18379
- * @param {Number} x X position
18380
- * @param {Number} y Y position
18381
- * @return {HTMLElement} Element of the first found nearest Sortable
18388
+ /**
18389
+ * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
18390
+ * @param {Number} x X position
18391
+ * @param {Number} y Y position
18392
+ * @return {HTMLElement} Element of the first found nearest Sortable
18382
18393
  */
18383
18394
  _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
18384
18395
  var ret;
@@ -18444,7 +18455,7 @@ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
18444
18455
  }; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
18445
18456
 
18446
18457
 
18447
- if (documentExists) {
18458
+ if (documentExists && !ChromeForAndroid) {
18448
18459
  document.addEventListener('click', function (evt) {
18449
18460
  if (ignoreNextClick) {
18450
18461
  evt.preventDefault();
@@ -18486,10 +18497,10 @@ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
18486
18497
  dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
18487
18498
  }
18488
18499
  };
18489
- /**
18490
- * @class Sortable
18491
- * @param {HTMLElement} el
18492
- * @param {Object} [options]
18500
+ /**
18501
+ * @class Sortable
18502
+ * @param {HTMLElement} el
18503
+ * @param {Object} [options]
18493
18504
  */
18494
18505
 
18495
18506
 
@@ -19063,6 +19074,7 @@ Sortable.prototype =
19063
19074
 
19064
19075
  if (!Sortable.eventCanceled) {
19065
19076
  cloneEl = clone(dragEl);
19077
+ cloneEl.removeAttribute("id");
19066
19078
  cloneEl.draggable = false;
19067
19079
  cloneEl.style['will-change'] = '';
19068
19080
 
@@ -19304,7 +19316,14 @@ Sortable.prototype =
19304
19316
 
19305
19317
  if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
19306
19318
  capture();
19307
- el.appendChild(dragEl);
19319
+
19320
+ if (elLastChild && elLastChild.nextSibling) {
19321
+ // the last draggable element is not the last node
19322
+ el.insertBefore(dragEl, elLastChild.nextSibling);
19323
+ } else {
19324
+ el.appendChild(dragEl);
19325
+ }
19326
+
19308
19327
  parentEl = el; // actualization
19309
19328
 
19310
19329
  changed();
@@ -19627,9 +19646,9 @@ Sortable.prototype =
19627
19646
  }
19628
19647
  },
19629
19648
 
19630
- /**
19631
- * Serializes the item into an array of string.
19632
- * @returns {String[]}
19649
+ /**
19650
+ * Serializes the item into an array of string.
19651
+ * @returns {String[]}
19633
19652
  */
19634
19653
  toArray: function toArray() {
19635
19654
  var order = [],
@@ -19650,9 +19669,9 @@ Sortable.prototype =
19650
19669
  return order;
19651
19670
  },
19652
19671
 
19653
- /**
19654
- * Sorts the elements according to the array.
19655
- * @param {String[]} order order of the items
19672
+ /**
19673
+ * Sorts the elements according to the array.
19674
+ * @param {String[]} order order of the items
19656
19675
  */
19657
19676
  sort: function sort(order, useAnimation) {
19658
19677
  var items = {},
@@ -19674,29 +19693,29 @@ Sortable.prototype =
19674
19693
  useAnimation && this.animateAll();
19675
19694
  },
19676
19695
 
19677
- /**
19678
- * Save the current sorting
19696
+ /**
19697
+ * Save the current sorting
19679
19698
  */
19680
19699
  save: function save() {
19681
19700
  var store = this.options.store;
19682
19701
  store && store.set && store.set(this);
19683
19702
  },
19684
19703
 
19685
- /**
19686
- * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
19687
- * @param {HTMLElement} el
19688
- * @param {String} [selector] default: `options.draggable`
19689
- * @returns {HTMLElement|null}
19704
+ /**
19705
+ * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
19706
+ * @param {HTMLElement} el
19707
+ * @param {String} [selector] default: `options.draggable`
19708
+ * @returns {HTMLElement|null}
19690
19709
  */
19691
19710
  closest: function closest$1(el, selector) {
19692
19711
  return closest(el, selector || this.options.draggable, this.el, false);
19693
19712
  },
19694
19713
 
19695
- /**
19696
- * Set/get option
19697
- * @param {string} name
19698
- * @param {*} [value]
19699
- * @returns {*}
19714
+ /**
19715
+ * Set/get option
19716
+ * @param {string} name
19717
+ * @param {*} [value]
19718
+ * @returns {*}
19700
19719
  */
19701
19720
  option: function option(name, value) {
19702
19721
  var options = this.options;
@@ -19718,8 +19737,8 @@ Sortable.prototype =
19718
19737
  }
19719
19738
  },
19720
19739
 
19721
- /**
19722
- * Destroy
19740
+ /**
19741
+ * Destroy
19723
19742
  */
19724
19743
  destroy: function destroy() {
19725
19744
  pluginEvent('destroy', this);
@@ -19896,11 +19915,11 @@ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, inv
19896
19915
 
19897
19916
  return 0;
19898
19917
  }
19899
- /**
19900
- * Gets the direction dragEl must be swapped relative to target in order to make it
19901
- * seem that dragEl has been "inserted" into that element's position
19902
- * @param {HTMLElement} target The target whose position dragEl is being inserted at
19903
- * @return {Number} Direction dragEl must be swapped
19918
+ /**
19919
+ * Gets the direction dragEl must be swapped relative to target in order to make it
19920
+ * seem that dragEl has been "inserted" into that element's position
19921
+ * @param {HTMLElement} target The target whose position dragEl is being inserted at
19922
+ * @return {Number} Direction dragEl must be swapped
19904
19923
  */
19905
19924
 
19906
19925
 
@@ -19911,11 +19930,11 @@ function _getInsertDirection(target) {
19911
19930
  return -1;
19912
19931
  }
19913
19932
  }
19914
- /**
19915
- * Generate id
19916
- * @param {HTMLElement} el
19917
- * @returns {String}
19918
- * @private
19933
+ /**
19934
+ * Generate id
19935
+ * @param {HTMLElement} el
19936
+ * @returns {String}
19937
+ * @private
19919
19938
  */
19920
19939
 
19921
19940
 
@@ -19979,18 +19998,18 @@ Sortable.utils = {
19979
19998
  detectDirection: _detectDirection,
19980
19999
  getChild: getChild
19981
20000
  };
19982
- /**
19983
- * Get the Sortable instance of an element
19984
- * @param {HTMLElement} element The element
19985
- * @return {Sortable|undefined} The instance of Sortable
20001
+ /**
20002
+ * Get the Sortable instance of an element
20003
+ * @param {HTMLElement} element The element
20004
+ * @return {Sortable|undefined} The instance of Sortable
19986
20005
  */
19987
20006
 
19988
20007
  Sortable.get = function (element) {
19989
20008
  return element[expando];
19990
20009
  };
19991
- /**
19992
- * Mount a plugin to Sortable
19993
- * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
20010
+ /**
20011
+ * Mount a plugin to Sortable
20012
+ * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
19994
20013
  */
19995
20014
 
19996
20015
 
@@ -20009,10 +20028,10 @@ Sortable.mount = function () {
20009
20028
  PluginManager.mount(plugin);
20010
20029
  });
20011
20030
  };
20012
- /**
20013
- * Create sortable instance
20014
- * @param {HTMLElement} el
20015
- * @param {Object} [options]
20031
+ /**
20032
+ * Create sortable instance
20033
+ * @param {HTMLElement} el
20034
+ * @param {Object} [options]
20016
20035
  */
20017
20036
 
20018
20037
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-components",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "Package for creating echo related components.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "license": "MIT",
30
30
  "peerDependencies": {
31
31
  "@equinor/echo-utils": "^0.2.7",
32
- "@equinor/eds-core-react": "^0.17.0",
32
+ "@equinor/eds-core-react": "^0.19.0",
33
33
  "react": "^17.0.2",
34
34
  "react-dom": "^17.0.2",
35
35
  "styled-components": "^5.3.3"
@@ -40,55 +40,55 @@
40
40
  "react-sortablejs": "^6.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@babel/core": "^7.17.5",
43
+ "@babel/core": "^7.17.8",
44
44
  "@babel/preset-env": "^7.16.11",
45
45
  "@babel/preset-react": "^7.16.7",
46
46
  "@babel/preset-typescript": "^7.16.7",
47
47
  "@equinor/echo-update": "^1.3.0",
48
48
  "@equinor/echo-utils": "^0.2.9",
49
- "@equinor/eds-core-react": "^0.17.0",
49
+ "@equinor/eds-core-react": "^0.19.0",
50
50
  "@rollup/plugin-node-resolve": "^13.1.3",
51
51
  "@rollup/plugin-typescript": "^8.3.1",
52
52
  "@rollup/plugin-url": "^6.1.0",
53
- "@storybook/addon-actions": "^6.4.19",
54
- "@storybook/addon-docs": "^6.4.19",
55
- "@storybook/addon-essentials": "^6.4.19",
56
- "@storybook/addon-links": "^6.4.19",
57
- "@storybook/builder-webpack5": "^6.4.19",
58
- "@storybook/manager-webpack5": "^6.4.19",
59
- "@storybook/react": "^6.4.19",
53
+ "@storybook/addon-actions": "^6.4.20",
54
+ "@storybook/addon-docs": "^6.4.20",
55
+ "@storybook/addon-essentials": "^6.4.20",
56
+ "@storybook/addon-links": "^6.4.20",
57
+ "@storybook/builder-webpack5": "^6.4.20",
58
+ "@storybook/manager-webpack5": "^6.4.20",
59
+ "@storybook/react": "^6.4.20",
60
60
  "@svgr/rollup": "^6.2.1",
61
61
  "@svgr/webpack": "^6.2.1",
62
- "@testing-library/dom": "^8.11.3",
63
- "@testing-library/react": "^12.1.3",
62
+ "@testing-library/dom": "^8.13.0",
63
+ "@testing-library/react": "^12.1.4",
64
64
  "@types/jest": "^27.4.1",
65
- "@types/react": "^17.0.39",
65
+ "@types/react": "^17.0.43",
66
66
  "@types/react-datepicker": "^4.3.4",
67
67
  "@types/react-test-renderer": "^17.0.1",
68
68
  "@types/react-window": "^1.8.5",
69
69
  "@types/sortablejs": "^1.10.7",
70
- "@typescript-eslint/eslint-plugin": "^5.14.0",
71
- "@typescript-eslint/parser": "^5.14.0",
72
- "babel-loader": "^8.2.3",
70
+ "@typescript-eslint/eslint-plugin": "^5.18.0",
71
+ "@typescript-eslint/parser": "^5.18.0",
72
+ "babel-loader": "^8.2.4",
73
73
  "css-loader": "^6.7.1",
74
- "eslint": "^8.10.0",
74
+ "eslint": "^8.12.0",
75
75
  "eslint-config-prettier": "^8.5.0",
76
76
  "eslint-plugin-prettier": "^4.0.0",
77
- "eslint-plugin-react": "^7.29.3",
78
- "eslint-plugin-react-hooks": "^4.3.0",
77
+ "eslint-plugin-react": "^7.29.4",
78
+ "eslint-plugin-react-hooks": "^4.4.0",
79
79
  "html-webpack-plugin": "^5.5.0",
80
80
  "identity-obj-proxy": "^3.0.0",
81
81
  "jest": "^27.5.1",
82
82
  "jest-svg-transformer": "^1.0.0",
83
- "postcss": "^8.4.8",
83
+ "postcss": "^8.4.12",
84
84
  "postcss-loader": "^6.2.1",
85
- "prettier": "^2.5.1",
85
+ "prettier": "^2.6.2",
86
86
  "react": "^17.0.2",
87
87
  "react-datepicker": "^4.7.0",
88
88
  "react-dom": "^17.0.2",
89
89
  "react-test-renderer": "^17.0.2",
90
90
  "react-window": "^1.8.6",
91
- "rollup": "^2.70.0",
91
+ "rollup": "^2.70.1",
92
92
  "rollup-plugin-babel": "^4.4.0",
93
93
  "rollup-plugin-commonjs": "^10.1.0",
94
94
  "rollup-plugin-delete": "^2.0.0",
@@ -99,13 +99,13 @@
99
99
  "rollup-plugin-typescript-paths": "^1.3.1",
100
100
  "rollup-plugin-typescript2": "^0.31.2",
101
101
  "rollup-plugin-web-worker-loader": "^1.6.1",
102
- "sortablejs": "^1.14.0",
102
+ "sortablejs": "^1.15.0",
103
103
  "storybook-css-modules-preset": "^1.1.1",
104
104
  "style-loader": "^3.3.1",
105
- "styled-components": "^5.3.3",
106
- "ts-jest": "^27.1.3",
107
- "typescript": "^4.6.2",
108
- "webpack": "^5.70.0",
105
+ "styled-components": "^5.3.5",
106
+ "ts-jest": "^27.1.4",
107
+ "typescript": "^4.6.3",
108
+ "webpack": "^5.71.0",
109
109
  "worker-loader": "^3.0.8"
110
110
  },
111
111
  "files": [
package/CHANGELOG.md DELETED
@@ -1,17 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The changelog is valid starting with EchoComponents v0.0.1.
6
- ****
7
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/#how),
8
- this project does not follow semantic versioning. Version numbers are bumped based on a subjective feeling of "change impact". Might consider changing this to `year.month.versioncounter` to simplify for users. (Example: 2021.03.55)
9
-
10
- ## v0.3.0
11
-
12
- ### Add
13
-
14
- ### Change
15
- - Now depending on EDS Core v0.17.0 and EDS Icons v0.10.0
16
-
17
- ### Fix