ag-common 0.0.301 → 0.0.304

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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare const Close: ({ className, onClick, }: {
2
+ export declare const Close: (p: {
3
3
  onClick?: ((ev: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
4
4
  className?: string | undefined;
5
5
  }) => JSX.Element;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Close = void 0;
7
+ const dom_1 = require("../../helpers/dom");
7
8
  const styled_components_1 = __importDefault(require("styled-components"));
8
9
  const react_1 = __importDefault(require("react"));
9
10
  const SClose = styled_components_1.default.div `
@@ -35,5 +36,7 @@ const SClose = styled_components_1.default.div `
35
36
  transform: rotate(-45deg);
36
37
  }
37
38
  `;
38
- const Close = ({ className, onClick, }) => react_1.default.createElement(SClose, { className: className, onClick: (e) => onClick === null || onClick === void 0 ? void 0 : onClick(e) });
39
+ const Close = (p) => {
40
+ return (react_1.default.createElement(SClose, Object.assign({}, (0, dom_1.filterDataProps)(p), { className: p.className, onClick: (e) => { var _a; return (_a = p.onClick) === null || _a === void 0 ? void 0 : _a.call(p, e); } })));
41
+ };
39
42
  exports.Close = Close;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { ReactNode } from 'react';
2
2
  export interface IDropdownList<T> {
3
3
  /**
4
4
  * all items that can be in dropdown
@@ -29,5 +29,5 @@ export interface IDropdownList<T> {
29
29
  /**
30
30
  * if not provided, will default display value, then kebab dots
31
31
  */
32
- children?: JSX.Element;
32
+ children?: ReactNode;
33
33
  }
@@ -1,6 +1,8 @@
1
- import React from 'react';
2
- export declare const FlexColumn: React.FC<React.ComponentPropsWithoutRef<'div'> & {
1
+ import { ReactNode } from 'react';
2
+ export declare const FlexColumn: (props: {
3
3
  noGrow?: boolean;
4
4
  center?: boolean;
5
5
  allowOverflow?: boolean;
6
- }>;
6
+ children: ReactNode;
7
+ className?: string;
8
+ }) => JSX.Element;
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FlexColumn = void 0;
7
- /* eslint-disable react/destructuring-assignment */
8
7
  const react_1 = __importDefault(require("react"));
9
8
  const styled_components_1 = __importDefault(require("styled-components"));
10
9
  const Base = styled_components_1.default.div `
@@ -1,7 +1,9 @@
1
- import React from 'react';
2
- export declare const FlexRow: React.FC<React.ComponentPropsWithoutRef<'div'> & {
1
+ import { ReactNode } from 'react';
2
+ export declare const FlexRow: (props: {
3
3
  noWrap?: boolean;
4
4
  noGrow?: boolean;
5
5
  center?: boolean;
6
6
  enableOverflow?: boolean;
7
- }>;
7
+ children: ReactNode;
8
+ className?: string;
9
+ }) => JSX.Element;
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FlexRow = void 0;
7
- /* eslint-disable react/destructuring-assignment */
8
7
  const react_1 = __importDefault(require("react"));
9
8
  const styled_components_1 = __importDefault(require("styled-components"));
10
9
  const Base = styled_components_1.default.div `
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  export interface IIconProps {
3
3
  disabled?: boolean;
4
4
  fill?: string;
@@ -14,7 +14,7 @@ export interface IIconProps {
14
14
  /** default 0 */
15
15
  padding?: string;
16
16
  onClick?: (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
17
- children?: JSX.Element | JSX.Element[];
17
+ children?: ReactNode;
18
18
  role?: string;
19
19
  title?: string;
20
20
  tabIndex?: number;
@@ -63,19 +63,12 @@ const LoadingBack = styled_components_1.default.div `
63
63
  }
64
64
  transition: opacity 5s;
65
65
  `;
66
- const Loader = ({ name, height, width, }) => {
66
+ const Loader = ({ name, height = '2rem', width = '2rem', }) => {
67
67
  const [trans, setTrans] = (0, react_1.useState)(true);
68
68
  (0, react_1.useEffect)(() => {
69
69
  setTrans(false);
70
70
  }, []);
71
- const style = {};
72
- if (width !== null) {
73
- style.width = width !== null && width !== void 0 ? width : '2rem';
74
- }
75
- if (height !== null) {
76
- style.height = height !== null && height !== void 0 ? height : '2rem';
77
- }
78
71
  return (react_1.default.createElement(LoadingBack, { "data-loading": name, "data-transparent": trans },
79
- react_1.default.createElement(SLoader, { style: style })));
72
+ react_1.default.createElement(SLoader, { style: { height: height, width: width } })));
80
73
  };
81
74
  exports.Loader = Loader;
@@ -102,7 +102,7 @@ const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'top'
102
102
  }
103
103
  return (react_1.default.createElement(FixedBackground, null,
104
104
  react_1.default.createElement(ModalBase, { "data-bounced": bounced, "data-position": position, "data-topposition": topPosition, ref: ref, className: className },
105
- showCloseButton && react_1.default.createElement(CloseStyled, { onClick: () => setOpen(false) }),
105
+ showCloseButton && (react_1.default.createElement(CloseStyled, { "data-type": "modal-close", onClick: () => setOpen(false) })),
106
106
  children)));
107
107
  };
108
108
  exports.Modal = Modal;
@@ -1,6 +1,8 @@
1
- import React from 'react';
2
- export declare const RowOrColumn: React.FC<React.ComponentPropsWithoutRef<'div'> & {
1
+ import { ReactNode } from 'react';
2
+ export declare const RowOrColumn: (props: {
3
3
  noGrow?: boolean;
4
4
  center?: boolean;
5
5
  noWrap?: boolean;
6
- }>;
6
+ children: ReactNode;
7
+ className?: string;
8
+ }) => JSX.Element;
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.RowOrColumn = void 0;
7
- /* eslint-disable react/destructuring-assignment */
8
7
  const media_1 = require("../../styles/media");
9
8
  const react_1 = __importDefault(require("react"));
10
9
  const styled_components_1 = __importDefault(require("styled-components"));
@@ -60,10 +60,10 @@ const CheckboxEdit = ({ defaultValue, onSubmit, noGrow = false, allowUndo = true
60
60
  onSubmit(!value);
61
61
  }
62
62
  }, onKeyPress: (e) => e.key === 'Enter' && value !== defaultValue && onSubmit(value) }),
63
- allowUndo && (react_1.default.createElement(Icons, { center: true, enableOverflow: true },
64
- value !== defaultValue && (react_1.default.createElement(common_1.IconD, { style: common_1.iconLeft, onClick: () => value !== defaultValue && onSubmit(value) },
65
- react_1.default.createElement(images_1.SaveIcon, null))),
66
- value !== defaultValue && (react_1.default.createElement(common_1.IconD, { style: common_1.iconRight, onClick: () => setValue(defaultValue) },
67
- react_1.default.createElement(images_1.UndoIcon, null)))))));
63
+ allowUndo && value !== defaultValue && (react_1.default.createElement(Icons, { center: true, enableOverflow: true },
64
+ react_1.default.createElement(common_1.IconD, { style: common_1.iconLeft, onClick: () => value !== defaultValue && onSubmit(value) },
65
+ react_1.default.createElement(images_1.SaveIcon, null)),
66
+ react_1.default.createElement(common_1.IconD, { style: common_1.iconRight, onClick: () => setValue(defaultValue) },
67
+ react_1.default.createElement(images_1.UndoIcon, null))))));
68
68
  };
69
69
  exports.CheckboxEdit = CheckboxEdit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.301",
3
+ "version": "0.0.304",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",