@rh-support/components 2.1.30 → 2.1.32

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.
@@ -6,6 +6,6 @@ interface IProps<T> {
6
6
  data: T;
7
7
  selectedColumns?: string[];
8
8
  }
9
- export declare function Table<T>({ children, columns, data, selectedColumns }: IProps<T>): JSX.Element;
9
+ export declare function TableComponent<T>({ children, columns, data, selectedColumns }: IProps<T>): JSX.Element;
10
10
  export {};
11
- //# sourceMappingURL=Table.d.ts.map
11
+ //# sourceMappingURL=TableComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableComponent.d.ts","sourceRoot":"","sources":["../../../src/Table/TableComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,UAAU,MAAM,CAAC,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,EAAE,CAAC,CAAC;IACR,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,eAkBxF"}
@@ -19,10 +19,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.Table = void 0;
22
+ exports.TableComponent = void 0;
23
23
  const react_1 = __importStar(require("react"));
24
24
  const TableProvider_1 = require("./TableProvider");
25
- function Table({ children, columns, data, selectedColumns }) {
25
+ function TableComponent({ children, columns, data, selectedColumns }) {
26
26
  const [currentPage, setSelectedPage] = react_1.useState(1);
27
27
  const [perPage, setPerPage] = react_1.useState(10);
28
28
  return (react_1.default.createElement(TableProvider_1.TableContext.Provider, { value: {
@@ -35,4 +35,4 @@ function Table({ children, columns, data, selectedColumns }) {
35
35
  selectedColumns,
36
36
  } }, children));
37
37
  }
38
- exports.Table = Table;
38
+ exports.TableComponent = TableComponent;
@@ -1,4 +1,4 @@
1
- export * from './Table';
1
+ export * from './TableComponent';
2
2
  export * from './PFTable';
3
3
  export * from './TableColumnSelector';
4
4
  export * from './TablePagination';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Table/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Table/index.tsx"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./Table"), exports);
13
+ __exportStar(require("./TableComponent"), exports);
14
14
  __exportStar(require("./PFTable"), exports);
15
15
  __exportStar(require("./TableColumnSelector"), exports);
16
16
  __exportStar(require("./TablePagination"), exports);
@@ -12,4 +12,5 @@ export * from './useLRUCache';
12
12
  export * from './useBreakpoint';
13
13
  export * from './useOnScreen';
14
14
  export * from './useSelectKeyboardNavigator';
15
+ export * from './useSessionStorage';
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC"}
@@ -24,3 +24,4 @@ __exportStar(require("./useLRUCache"), exports);
24
24
  __exportStar(require("./useBreakpoint"), exports);
25
25
  __exportStar(require("./useOnScreen"), exports);
26
26
  __exportStar(require("./useSelectKeyboardNavigator"), exports);
27
+ __exportStar(require("./useSessionStorage"), exports);
@@ -0,0 +1,5 @@
1
+ declare type Dispatch<A> = (value: A) => void;
2
+ declare type SetStateAction<S> = S | ((prevState: S) => S);
3
+ declare const useSessionStorage: <T>(key: string, initialValue?: T, raw?: boolean) => [T, Dispatch<SetStateAction<T>>];
4
+ export { useSessionStorage };
5
+ //# sourceMappingURL=useSessionStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSessionStorage.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSessionStorage.ts"],"names":[],"mappings":"AAEA,aAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AACtC,aAAK,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAEnD,QAAA,MAAM,iBAAiB,WAAY,MAAM,0BAA0B,OAAO,qCA0BzE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSessionStorage = void 0;
4
+ const react_1 = require("react");
5
+ const useSessionStorage = (key, initialValue, raw) => {
6
+ const [state, setState] = react_1.useState(() => {
7
+ try {
8
+ const sessionStorageValue = sessionStorage.getItem(key);
9
+ if (typeof sessionStorageValue !== 'string') {
10
+ sessionStorage.setItem(key, raw ? String(initialValue) : JSON.stringify(initialValue));
11
+ return initialValue;
12
+ }
13
+ else {
14
+ return raw ? sessionStorageValue : JSON.parse(sessionStorageValue || 'null');
15
+ }
16
+ }
17
+ catch (_a) {
18
+ return initialValue;
19
+ }
20
+ });
21
+ react_1.useEffect(() => {
22
+ try {
23
+ const serializedState = raw ? String(state) : JSON.stringify(state);
24
+ sessionStorage.setItem(key, serializedState);
25
+ }
26
+ catch (_a) {
27
+ //
28
+ }
29
+ // eslint-disable-next-line react-hooks/exhaustive-deps
30
+ }, [state]);
31
+ return [state, setState];
32
+ };
33
+ exports.useSessionStorage = useSessionStorage;
@@ -6,6 +6,6 @@ interface IProps<T> {
6
6
  data: T;
7
7
  selectedColumns?: string[];
8
8
  }
9
- export declare function Table<T>({ children, columns, data, selectedColumns }: IProps<T>): JSX.Element;
9
+ export declare function TableComponent<T>({ children, columns, data, selectedColumns }: IProps<T>): JSX.Element;
10
10
  export {};
11
- //# sourceMappingURL=Table.d.ts.map
11
+ //# sourceMappingURL=TableComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableComponent.d.ts","sourceRoot":"","sources":["../../../src/Table/TableComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,UAAU,MAAM,CAAC,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,EAAE,CAAC,CAAC;IACR,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,eAkBxF"}
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { TableContext } from './TableProvider';
3
- export function Table({ children, columns, data, selectedColumns }) {
3
+ export function TableComponent({ children, columns, data, selectedColumns }) {
4
4
  const [currentPage, setSelectedPage] = useState(1);
5
5
  const [perPage, setPerPage] = useState(10);
6
6
  return (React.createElement(TableContext.Provider, { value: {
@@ -1,4 +1,4 @@
1
- export * from './Table';
1
+ export * from './TableComponent';
2
2
  export * from './PFTable';
3
3
  export * from './TableColumnSelector';
4
4
  export * from './TablePagination';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Table/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Table/index.tsx"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
@@ -1,4 +1,4 @@
1
- export * from './Table';
1
+ export * from './TableComponent';
2
2
  export * from './PFTable';
3
3
  export * from './TableColumnSelector';
4
4
  export * from './TablePagination';
@@ -12,4 +12,5 @@ export * from './useLRUCache';
12
12
  export * from './useBreakpoint';
13
13
  export * from './useOnScreen';
14
14
  export * from './useSelectKeyboardNavigator';
15
+ export * from './useSessionStorage';
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC"}
@@ -12,3 +12,4 @@ export * from './useLRUCache';
12
12
  export * from './useBreakpoint';
13
13
  export * from './useOnScreen';
14
14
  export * from './useSelectKeyboardNavigator';
15
+ export * from './useSessionStorage';
@@ -0,0 +1,5 @@
1
+ declare type Dispatch<A> = (value: A) => void;
2
+ declare type SetStateAction<S> = S | ((prevState: S) => S);
3
+ declare const useSessionStorage: <T>(key: string, initialValue?: T, raw?: boolean) => [T, Dispatch<SetStateAction<T>>];
4
+ export { useSessionStorage };
5
+ //# sourceMappingURL=useSessionStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSessionStorage.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSessionStorage.ts"],"names":[],"mappings":"AAEA,aAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AACtC,aAAK,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAEnD,QAAA,MAAM,iBAAiB,WAAY,MAAM,0BAA0B,OAAO,qCA0BzE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { useEffect, useState } from 'react';
2
+ const useSessionStorage = (key, initialValue, raw) => {
3
+ const [state, setState] = useState(() => {
4
+ try {
5
+ const sessionStorageValue = sessionStorage.getItem(key);
6
+ if (typeof sessionStorageValue !== 'string') {
7
+ sessionStorage.setItem(key, raw ? String(initialValue) : JSON.stringify(initialValue));
8
+ return initialValue;
9
+ }
10
+ else {
11
+ return raw ? sessionStorageValue : JSON.parse(sessionStorageValue || 'null');
12
+ }
13
+ }
14
+ catch (_a) {
15
+ return initialValue;
16
+ }
17
+ });
18
+ useEffect(() => {
19
+ try {
20
+ const serializedState = raw ? String(state) : JSON.stringify(state);
21
+ sessionStorage.setItem(key, serializedState);
22
+ }
23
+ catch (_a) {
24
+ //
25
+ }
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ }, [state]);
28
+ return [state, setState];
29
+ };
30
+ export { useSessionStorage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/components",
3
- "version": "2.1.30",
3
+ "version": "2.1.32",
4
4
  "description": "Contains all reusabel components for support app",
5
5
  "author": "Vikas Rathee <vrathee@redhat.com>",
6
6
  "license": "ISC",
@@ -79,8 +79,8 @@
79
79
  "@patternfly/react-core": "5.1.1",
80
80
  "@patternfly/react-table": "5.1.1",
81
81
  "@rh-support/types": "2.0.2",
82
- "@rh-support/user-permissions": "2.1.21",
83
- "@rh-support/utils": "2.1.14",
82
+ "@rh-support/user-permissions": "2.1.22",
83
+ "@rh-support/utils": "2.1.15",
84
84
  "dompurify": "^2.2.6",
85
85
  "downshift": "^6.0.5",
86
86
  "js-worker-search": "^1.4.1",
@@ -90,6 +90,7 @@
90
90
  "react": "17.0.2",
91
91
  "react-bootstrap-typeahead": "^5.1.4",
92
92
  "react-dom": "17.0.2",
93
+ "react-i18next": "^13.2.2",
93
94
  "react-router-dom": "^5.1.2",
94
95
  "react-toastify": "^5.4.1",
95
96
  "resize-observer-polyfill": "^1.5.1",
@@ -115,5 +116,5 @@
115
116
  "defaults and supports es6-module",
116
117
  "maintained node versions"
117
118
  ],
118
- "gitHead": "c5a573ae8bd924caf9689a0179fde2181038b4e9"
119
+ "gitHead": "462d269eaba23f3e9b735caf2157f24f2a841da2"
119
120
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,UAAU,MAAM,CAAC,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,EAAE,CAAC,CAAC;IACR,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,eAkB/E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,UAAU,MAAM,CAAC,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,IAAI,EAAE,CAAC,CAAC;IACR,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,eAkB/E"}