@antscorp/antsomi-ui 1.3.3-beta.14 → 1.3.3-beta.16

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 (31) hide show
  1. package/es/components/molecules/ResizeGrid/ResizeGrid.js +3 -2
  2. package/es/components/molecules/ResizeGrid/styled.d.ts +3 -1
  3. package/es/components/molecules/ResizeGrid/styled.js +1 -0
  4. package/es/components/molecules/ResizeGrid/types.d.ts +1 -0
  5. package/es/hooks/useDeepCompareEffect.d.ts +1 -0
  6. package/es/hooks/useDeepCompareEffect.js +21 -0
  7. package/package.json +1 -1
  8. package/dist/0173b5993573afa04880.woff +0 -0
  9. package/dist/0dfb9214dfd945cd7290.png +0 -1
  10. package/dist/2883cad25a2b4e87ce5f.eot +0 -0
  11. package/dist/4f54a37971347e3d7122.png +0 -1
  12. package/dist/574b7bee0563a9fe9a29.png +0 -1
  13. package/dist/6b586356e837581204dc.svg +0 -1
  14. package/dist/72eec5c1c786b45a667f.ttf +0 -0
  15. package/dist/bc6bf11c6f5e6743aa4c.png +0 -1
  16. package/dist/dbc405edd6e0806efbc9.svg +0 -1
  17. package/dist/e32f09119052a55cce3c.png +0 -1
  18. package/dist/e3851b9384a984c6fdb5.png +0 -1
  19. package/dist/index.js +0 -2
  20. package/dist/index.js.LICENSE.txt +0 -69
  21. package/dist/main.css +0 -168
  22. package/dist/public/icons/2d496b55d85a9545d7311c073af442bb.png +0 -0
  23. package/dist/public/icons/2fbb4e0927d18e3f8e5c6511ab88d5b3.png +0 -0
  24. package/dist/public/icons/725a52bd91a3ce534b10833df510e5fa.png +0 -0
  25. package/dist/public/icons/7d037e0b378e87a82804443636cd0e13.svg +0 -346
  26. package/dist/public/icons/90553767e0a05b9585a54797cfd9ce51.png +0 -0
  27. package/dist/public/icons/bb64e23a1ff390a416d765ee556096ab.svg +0 -87
  28. package/dist/public/icons/d327b24e9c5d8f486f08d253aab58ce6.png +0 -0
  29. package/dist/public/icons/f1cf266d0a0a53ce07f2dbb859869b7a.png +0 -0
  30. package/dist/public/icons/placeholder-image.png +0 -0
  31. package/dist/public/icons/transparent.svg +0 -1
@@ -9,9 +9,10 @@ const defaultProps = {
9
9
  cellStyle: {},
10
10
  cellActiveStyle: {},
11
11
  isPreviewMode: false,
12
+ isCompact: false,
12
13
  };
13
14
  export const ResizeGrid = props => {
14
- const { containerStyle, cellBorderStyle, cellStyle, cellActiveStyle, isPreviewMode, renderCell, grid: initGrid, image, imageSize, imagePosition, } = props;
15
+ const { containerStyle, cellBorderStyle, cellStyle, cellActiveStyle, isPreviewMode, renderCell, grid: initGrid, image, imageSize, imagePosition, isCompact, } = props;
15
16
  const [grid, setGrid] = useState(buildGrid(initGrid || GRID_TEMPLATE.GRID_2_3));
16
17
  const startRef = useRef(null);
17
18
  const startCellRef = useRef(null);
@@ -347,6 +348,6 @@ export const ResizeGrid = props => {
347
348
  // console.log('grid', { gridTemplateColumns, gridTemplateRows, childs });
348
349
  return (React.createElement("div", { className: "grid-container", ref: containerRef, style: Object.assign({ backgroundImage: `url(${image})`, backgroundSize: imageSize, backgroundPosition: imagePosition, gridTemplateColumns: gridTemplateColumns.map(fr => `${fr}%`).join(' '), gridTemplateRows: gridTemplateRows.map(fr => `${fr}%`).join(' ') }, containerStyle) }, childs.map((cell, idx) => (React.createElement(Cell, { key: idx, idx: idx, cell: cell, down: handleDown, downCell: handleDownCell, up: handleUp, setRef: setRef, downSelect: downSelect, upSelect: upSelect, hoverSelect: hoverSelect, unMerge: unMerge, renderCell: renderCell, borderStyle: cellBorderStyle, style: cellStyle, activeStyle: cellActiveStyle, isPreviewMode: isPreviewMode })))));
349
350
  };
350
- return React.createElement(StyledGrid, { className: "grid-wrapper" }, renderGrid());
351
+ return (React.createElement(StyledGrid, { className: "grid-wrapper", isCompact: !!isCompact }, renderGrid()));
351
352
  };
352
353
  ResizeGrid.defaultProps = defaultProps;
@@ -1 +1,3 @@
1
- export declare const StyledGrid: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const StyledGrid: import("styled-components").StyledComponent<"div", any, {
2
+ isCompact: boolean;
3
+ }, never>;
@@ -16,5 +16,6 @@ export const StyledGrid = styled.div `
16
16
  background-repeat: no-repeat;
17
17
  background-position: top left;
18
18
  background-size: 100% 100%;
19
+ aspect-ratio: ${props => (props.isCompact ? '3 / 1' : '3 / 2')};
19
20
  }
20
21
  `;
@@ -124,4 +124,5 @@ export interface IResizeGridProps {
124
124
  cellBorderStyle?: string;
125
125
  cellActiveStyle?: React.CSSProperties;
126
126
  containerStyle?: React.CSSProperties;
127
+ isCompact?: boolean;
127
128
  }
@@ -0,0 +1 @@
1
+ export declare function useDeepCompareEffect(callback: any, dependencies: any): void;
@@ -0,0 +1,21 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import isEqual from 'react-fast-compare';
3
+ function deepCompareEquals(a, b) {
4
+ // TODO: implement deep comparison here
5
+ // something like lodash
6
+ // return _.isEqual(a, b);
7
+ return isEqual(a, b);
8
+ }
9
+ function useDeepCompareMemoize(value) {
10
+ const ref = useRef();
11
+ // it can be done by using useMemo as well
12
+ // but useRef is rather cleaner and easier
13
+ if (!deepCompareEquals(value, ref.current)) {
14
+ ref.current = value;
15
+ }
16
+ return ref.current;
17
+ }
18
+ export function useDeepCompareEffect(callback, dependencies) {
19
+ // eslint-disable-next-line react-hooks/exhaustive-deps
20
+ useEffect(callback, dependencies.map(useDeepCompareMemoize));
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.3-beta.14",
3
+ "version": "1.3.3-beta.16",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
Binary file
@@ -1 +0,0 @@
1
- export default __webpack_public_path__ + "/public/icons/d327b24e9c5d8f486f08d253aab58ce6.png";
Binary file
@@ -1 +0,0 @@
1
- export default __webpack_public_path__ + "/public/icons/725a52bd91a3ce534b10833df510e5fa.png";
@@ -1 +0,0 @@
1
- export default __webpack_public_path__ + "/public/icons/2d496b55d85a9545d7311c073af442bb.png";
@@ -1 +0,0 @@
1
- export default __webpack_public_path__ + "/public/icons/bb64e23a1ff390a416d765ee556096ab.svg";
Binary file
@@ -1 +0,0 @@
1
- export default __webpack_public_path__ + "/public/icons/2fbb4e0927d18e3f8e5c6511ab88d5b3.png";
@@ -1 +0,0 @@
1
- export default __webpack_public_path__ + "/public/icons/7d037e0b378e87a82804443636cd0e13.svg";
@@ -1 +0,0 @@
1
- export default __webpack_public_path__ + "/public/icons/90553767e0a05b9585a54797cfd9ce51.png";
@@ -1 +0,0 @@
1
- export default __webpack_public_path__ + "/public/icons/f1cf266d0a0a53ce07f2dbb859869b7a.png";