@micromag/element-grid 0.4.49 → 0.4.50

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 (2) hide show
  1. package/es/index.js +43 -41
  2. package/package.json +3 -3
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import classNames from 'classnames';
2
2
  import isArray from 'lodash/isArray';
3
- import React from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
4
 
5
5
  var styles = {"container":"micromag-element-grid-container","items":"micromag-element-grid-items","cross":"micromag-element-grid-cross","axis":"micromag-element-grid-axis"};
6
6
 
@@ -40,52 +40,54 @@ function Grid(_ref) {
40
40
  columns = _ref2$columns === void 0 ? 1 : _ref2$columns;
41
41
  return total + (vertical ? columns : rows);
42
42
  }, 0);
43
- return /*#__PURE__*/React.createElement("div", {
43
+ return /*#__PURE__*/jsx("div", {
44
44
  className: classNames([styles.container, className]),
45
45
  style: {
46
46
  width: width,
47
47
  height: height,
48
48
  padding: spacing !== null && spacing > 0 ? spacing / 2 : null
49
- }
50
- }, /*#__PURE__*/React.createElement("div", {
51
- className: styles.items,
52
- style: {
53
- flexDirection: vertical ? 'row' : 'column'
54
- }
55
- }, finalLayout.map(function (_ref3, crossIndex) {
56
- var rows = _ref3.rows,
57
- columns = _ref3.columns;
58
- var crossSizeRatio = (vertical ? columns : rows) / crossTotal;
59
- var crossSize = "".concat(100 * crossSizeRatio, "%");
60
- var axisItems = vertical ? rows : columns;
61
- var finalAxisItems = isArray(axisItems) ? axisItems : [axisItems];
62
- var axisTotal = finalAxisItems.reduce(function (total, it) {
63
- return total + it;
64
- }, 0);
65
- return /*#__PURE__*/React.createElement("div", {
66
- key: "cross-".concat(crossIndex),
67
- className: classNames([styles.cross, crossClassName]),
49
+ },
50
+ children: /*#__PURE__*/jsx("div", {
51
+ className: styles.items,
68
52
  style: {
69
- flexDirection: vertical ? 'column' : 'row',
70
- width: vertical ? crossSize : null,
71
- height: vertical ? null : crossSize
72
- }
73
- }, finalAxisItems.map(function (axisItem, axisIndex) {
74
- var axisSizeRatio = axisItem / axisTotal;
75
- var axisSize = "".concat(100 * axisSizeRatio, "%");
76
- var item = items[itemIndex];
77
- itemIndex += 1;
78
- return /*#__PURE__*/React.createElement("div", {
79
- key: "axis-".concat(axisIndex),
80
- className: classNames([styles.axis, axisClassName]),
81
- style: {
82
- width: vertical ? null : axisSize,
83
- height: vertical ? axisSize : null,
84
- padding: spacing > 0 ? spacing / 2 : 0
85
- }
86
- }, item);
87
- }));
88
- })));
53
+ flexDirection: vertical ? 'row' : 'column'
54
+ },
55
+ children: finalLayout.map(function (_ref3, crossIndex) {
56
+ var rows = _ref3.rows,
57
+ columns = _ref3.columns;
58
+ var crossSizeRatio = (vertical ? columns : rows) / crossTotal;
59
+ var crossSize = "".concat(100 * crossSizeRatio, "%");
60
+ var axisItems = vertical ? rows : columns;
61
+ var finalAxisItems = isArray(axisItems) ? axisItems : [axisItems];
62
+ var axisTotal = finalAxisItems.reduce(function (total, it) {
63
+ return total + it;
64
+ }, 0);
65
+ return /*#__PURE__*/jsx("div", {
66
+ className: classNames([styles.cross, crossClassName]),
67
+ style: {
68
+ flexDirection: vertical ? 'column' : 'row',
69
+ width: vertical ? crossSize : null,
70
+ height: vertical ? null : crossSize
71
+ },
72
+ children: finalAxisItems.map(function (axisItem, axisIndex) {
73
+ var axisSizeRatio = axisItem / axisTotal;
74
+ var axisSize = "".concat(100 * axisSizeRatio, "%");
75
+ var item = items[itemIndex];
76
+ itemIndex += 1;
77
+ return /*#__PURE__*/jsx("div", {
78
+ className: classNames([styles.axis, axisClassName]),
79
+ style: {
80
+ width: vertical ? null : axisSize,
81
+ height: vertical ? axisSize : null,
82
+ padding: spacing > 0 ? spacing / 2 : 0
83
+ },
84
+ children: item
85
+ }, "axis-".concat(axisIndex));
86
+ })
87
+ }, "cross-".concat(crossIndex));
88
+ })
89
+ })
90
+ });
89
91
  }
90
92
 
91
93
  export { Grid as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-grid",
3
- "version": "0.4.49",
3
+ "version": "0.4.50",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@babel/runtime": "^7.28.6",
63
- "@micromag/core": "^0.4.49",
63
+ "@micromag/core": "^0.4.50",
64
64
  "classnames": "^2.2.6",
65
65
  "lodash": "^4.17.23",
66
66
  "react-intl": "^8.1.3 || ^10.0.0",
@@ -70,6 +70,6 @@
70
70
  "access": "public",
71
71
  "registry": "https://registry.npmjs.org/"
72
72
  },
73
- "gitHead": "0a225ff29387217cccb0fcc5a731e23c74bd202e",
73
+ "gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
74
74
  "types": "es/index.d.ts"
75
75
  }