ag-common 0.0.276 → 0.0.280

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 (39) hide show
  1. package/dist/ui/components/Chevron/index.d.ts +1 -0
  2. package/dist/ui/components/Confirm/Modal.d.ts +1 -0
  3. package/dist/ui/components/DropdownList/index.d.ts +1 -0
  4. package/dist/ui/components/DropdownList/types.d.ts +1 -0
  5. package/dist/ui/components/HeadersRaw/index.d.ts +1 -0
  6. package/dist/ui/components/KebabDots/index.d.ts +1 -0
  7. package/dist/ui/components/Loader/index.d.ts +1 -0
  8. package/dist/ui/components/LoginButton/index.d.ts +1 -0
  9. package/dist/ui/components/LogoutButton/index.d.ts +1 -0
  10. package/dist/ui/components/Modal/index.d.ts +1 -0
  11. package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.d.ts +1 -0
  12. package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.d.ts +1 -0
  13. package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.d.ts +1 -0
  14. package/dist/ui/components/OpenApiCodeBlock/curl/index.d.ts +1 -0
  15. package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.d.ts +1 -0
  16. package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.d.ts +1 -0
  17. package/dist/ui/components/OpenApiCodeBlock/fetch/index.d.ts +1 -0
  18. package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.d.ts +1 -0
  19. package/dist/ui/components/OpenApiCodeBlock/types.d.ts +1 -0
  20. package/dist/ui/components/Prompt/Modal.d.ts +1 -0
  21. package/dist/ui/components/Search/Base.d.ts +1 -0
  22. package/dist/ui/components/Search/Inline.d.ts +1 -0
  23. package/dist/ui/components/Search/Modal.d.ts +1 -0
  24. package/dist/ui/components/Search/types.d.ts +1 -0
  25. package/dist/ui/components/Sidebar/index.d.ts +1 -0
  26. package/dist/ui/components/SparkLine/index.d.ts +1 -0
  27. package/dist/ui/components/Table/index.d.ts +1 -0
  28. package/dist/ui/components/Table/index.js +8 -3
  29. package/dist/ui/components/TextEdit/CheckboxEdit.d.ts +1 -0
  30. package/dist/ui/components/TextEdit/ColourEdit.d.ts +1 -0
  31. package/dist/ui/components/TextEdit/LengthBox.d.ts +1 -0
  32. package/dist/ui/components/TextEdit/ListboxEdit.d.ts +1 -0
  33. package/dist/ui/components/TextEdit/RadioGroup.d.ts +1 -0
  34. package/dist/ui/components/TextEdit/TextEdit.d.ts +1 -0
  35. package/dist/ui/components/TextEdit/images.d.ts +1 -0
  36. package/dist/ui/components/Toast/index.d.ts +1 -0
  37. package/dist/ui/components/UserImage/index.d.ts +1 -0
  38. package/dist/ui/helpers/useContextMenu.js +3 -1
  39. package/package.json +7 -7
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Chevron: ({ width, className, colour, onToggle, point, }: {
2
3
  /**
3
4
  * default right
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const ConfirmModal: ({ onSubmit, bottomText, topText, okText, cancelText, }: {
2
3
  onSubmit: (v: boolean) => void;
3
4
  topText?: string | undefined;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IDropdownList } from './types';
2
3
  export declare function DropdownList<T>(p: IDropdownList<T>): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface IDropdownList<T> {
2
3
  /**
3
4
  * all items that can be in dropdown
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface IHeadersRaw {
2
3
  title?: string;
3
4
  image?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const KebabDots: ({ onClick }: {
2
3
  onClick?: (() => Promise<void>) | undefined;
3
4
  }) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Loader: ({ name, height, width, }: {
2
3
  /**
3
4
  * default 2rem
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const LoginButton: ({ className, text, invert, savePath, loginPath, style, }: {
2
3
  invert?: boolean | undefined;
3
4
  text: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const LogoutButton: ({ className, invert, logout, }: {
2
3
  invert?: boolean | undefined;
3
4
  className?: string | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const ModalItem: import("styled-components").StyledComponent<"div", any, {}, never>;
2
3
  export declare const Modal: ({ open, setOpen, children, position, topPosition, showCloseButton, closeOnMoveMouseOutside, className, closeOnClickOutside, }: {
3
4
  open: boolean;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IOpenApiCodeBlock } from './types';
2
3
  export declare const OpenApiCodeBlock: <TDefaultApi>(p: IOpenApiCodeBlock<TDefaultApi>) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IOpenApiCodeBlock } from '../../types';
2
3
  export declare const getBody: <TDefaultApi>(p: IOpenApiCodeBlock<TDefaultApi>) => {
3
4
  content: JSX.Element | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IOpenApi, IOpenApiOperation } from '../../types';
2
3
  export declare const getSecurityLine: (p: {
3
4
  apiKey?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IOpenApiCodeBlock, IOpenApiOperationBlock } from '../types';
2
3
  export declare const Curl: <TDefaultApi>({ ops, p, }: {
3
4
  p: IOpenApiCodeBlock<TDefaultApi>;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IOpenApiCodeBlock, IOpenApiOperationBlock } from '../../types';
2
3
  export declare const getFetchCall: <TDefaultApi>(p: IOpenApiCodeBlock<TDefaultApi>, ops: IOpenApiOperationBlock) => JSX.Element | undefined;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { IOpenApiCodeBlock, IOpenApiOperationBlock } from '../../types';
2
3
  export declare const getRequestOptions: <TDefaultApi>(p: IOpenApiCodeBlock<TDefaultApi>, ops: IOpenApiOperationBlock) => JSX.Element | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IOpenApiCodeBlock, IOpenApiOperationBlock } from '../types';
2
3
  export declare const Fetch: <TDefaultApi>({ ops, p, }: {
3
4
  p: IOpenApiCodeBlock<TDefaultApi>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const joinJsx: (items: (JSX.Element | undefined)[], sep: JSX.Element[]) => JSX.Element[];
2
3
  export declare const joinJsxWithSlash: (items: (JSX.Element | undefined)[]) => JSX.Element[];
3
4
  export declare const joinJsxWithComma: (items: (JSX.Element | undefined)[]) => JSX.Element[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface IOpenApiOperation {
2
3
  description: string;
3
4
  operationId: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const PromptModal: ({ wrapper, res, bottomText, topText, okText, cancelText, defaultValue, placeholder, }: {
2
3
  defaultValue?: string | undefined;
3
4
  placeholder?: string | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ISearchDialog, TSearchModalRes } from './types';
2
3
  export declare const SearchBase: <T>({ onSelectItem, onSearchTextChange, placeholderText, closeText, renderItem, displayItems, willDisplayItem, getKeyF, className, texts, }: ISearchDialog<T> & {
3
4
  onSearchTextChange?: ((v: string) => void) | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ISearchDialog, TSearchModalRes } from './types';
2
3
  export declare const SearchInline: <T>(p: ISearchDialog<T> & {
3
4
  onSelectItem?: ((v: TSearchModalRes<T>) => void) | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ISearchDialog, TSearchModalRes } from './types';
2
3
  export declare const SearchModal: <T>(p: ISearchDialog<T> & {
3
4
  onSelectItem: (v: TSearchModalRes<T>) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface ISearchDialog<T> {
2
3
  placeholderText?: string;
3
4
  closeText?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Sidebar: ({ children, className, key, cookieDocument, width, }: {
2
3
  children: any;
3
4
  className?: string | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface ISparkLine {
2
3
  /**
3
4
  * default #4d76ff
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface TableItem {
2
3
  content: JSX.Element;
3
4
  groupTitle: string;
@@ -25,15 +25,20 @@ const TableRow = styled_components_1.default.div `
25
25
  const Group = styled_components_1.default.div `
26
26
  display: flex;
27
27
  flex-flow: column;
28
+ width: 100%;
28
29
  `;
29
30
  const GroupTitle = styled_components_1.default.div `
30
31
  font-size: 1.5rem;
31
32
  `;
33
+ const GroupWrap = styled_components_1.default.div `
34
+ display: flex;
35
+ flex-flow: row;
36
+ `;
32
37
  const Table = ({ children, className, headerRow, }) => {
33
38
  const grouped = (0, groupBy_1.groupByList)(children, (s) => s.groupTitle);
34
- return (react_1.default.createElement(Base, { className: className }, grouped.map((group) => (react_1.default.createElement(react_1.default.Fragment, null,
35
- group.key && (react_1.default.createElement(GroupTitle, { key: `grouptitle${group.key}` }, group.key)),
36
- react_1.default.createElement(Group, { key: `group${group.key}` },
39
+ return (react_1.default.createElement(Base, { className: className }, grouped.map((group) => (react_1.default.createElement(GroupWrap, { key: 'gk' + group.key },
40
+ group.key && (react_1.default.createElement(GroupTitle, { key: `gt${group.key}` }, group.key)),
41
+ react_1.default.createElement(Group, { key: `g${group.key}` },
37
42
  headerRow && (react_1.default.createElement(TableRow, { "data-header": "true", key: `headrow${group.key}` }, headerRow)),
38
43
  group.items.map((item) => (react_1.default.createElement(TableRow, { key: item.content.key }, item.content)))))))));
39
44
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const CheckboxEdit: ({ defaultValue, onSubmit, noGrow, allowUndo, }: {
2
3
  defaultValue: boolean;
3
4
  onSubmit: (val: boolean) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const ColourEdit: ({ defaultValue, onSubmit, }: {
2
3
  defaultValue: string;
3
4
  onSubmit: (val: string) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const TextEditLengthBox: ({ min, max, }: {
2
3
  min: number;
3
4
  max: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const ListboxEdit: <T>({ defaultValue, onSubmit, values, canEdit, renderLabel, }: {
2
3
  defaultValue: T;
3
4
  onSubmit: (val: T) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const RadioGroup: <T>({ defaultValue, onSubmit, values, renderLabel, renderValue, }: {
2
3
  /**
3
4
  * can overload the render of the label. defaults to toString
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ITextEdit } from './types';
2
3
  import { StyledComponent } from 'styled-components';
3
4
  export declare const ValueReadonly: StyledComponent<"div", any, {}, never>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const UndoIcon: () => JSX.Element;
2
3
  export declare const PencilIcon: () => JSX.Element;
3
4
  export declare const SaveIcon: () => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ToastPosition } from 'react-hot-toast';
2
3
  export interface IToastOptions {
3
4
  appearance: 'error' | 'success';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { User } from '../../helpers/jwt';
2
3
  export declare const UserImageIcon: JSX.Element;
3
4
  export declare const UserImage: ({ image, className, }: {
@@ -6,7 +6,9 @@ const useContextMenu = ({ ref, }) => {
6
6
  const [xPos, setXPos] = (0, react_1.useState)('0px');
7
7
  const [yPos, setYPos] = (0, react_1.useState)('0px');
8
8
  const [showMenu, setShowMenu] = (0, react_1.useState)(false);
9
- const handleContextMenu = (0, react_1.useCallback)((e) => {
9
+ const handleContextMenu = (0, react_1.useCallback)(
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ (e) => {
10
12
  var _a;
11
13
  if (!((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
12
14
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.276",
3
+ "version": "0.0.280",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",
@@ -42,14 +42,14 @@
42
42
  "@storybook/react": "6.5.9",
43
43
  "@storybook/theming": "6.5.9",
44
44
  "@types/jsonwebtoken": "8.5.8",
45
- "@types/node": "18.0.0",
46
- "@types/react": "17.0.43",
47
- "@types/react-dom": "17.0.14",
45
+ "@types/node": "18.0.1",
46
+ "@types/react": "18.0.14",
47
+ "@types/react-dom": "18.0.5",
48
48
  "@types/styled-components": "5.1.25",
49
- "@typescript-eslint/eslint-plugin": "5.30.0",
50
- "@typescript-eslint/parser": "5.30.0",
49
+ "@typescript-eslint/eslint-plugin": "5.30.5",
50
+ "@typescript-eslint/parser": "5.30.5",
51
51
  "cross-env": "7.0.3",
52
- "eslint": "8.18.0",
52
+ "eslint": "8.19.0",
53
53
  "eslint-config-airbnb-typescript": "17.0.0",
54
54
  "eslint-config-prettier": "8.5.0",
55
55
  "eslint-plugin-import": "2.26.0",